• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Thread crashing problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread crashing problem


  • Subject: Re: Thread crashing problem
  • From: "Kyle Sluder" <email@hidden>
  • Date: Mon, 22 Dec 2008 11:10:07 -0500

On Mon, Dec 22, 2008 at 10:42 AM, Ken Tozier <email@hidden> wrote:
> "You should not use this class to implement a recursive lock. Calling the
> lock method twice on the same thread will lock up your thread permanently.
> Use the NSRecursiveLock class to implement recursive locks instead."

It says "lock", not "tryLock."

> Given that, could you give a really simple example of how to coordinate
> access between the three methods? @synchronized may be the way to go but it
> doesn't explain how one method could determine busy status and wait for an
> opening before doing its thing.

Simply put, when you're doing threading, you don't "determine"
anything.  You use the synchronization primitives you have to control
your code.  Any attempt you make to "determine" which thread should
execute will either be 1) useless because the synchronization
primitives are already controlling thread execution; or 2) incorrect
because you've introduced the very race conditions you're trying to
avoid.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Thread crashing problem (From: Scott Ribe <email@hidden>)
 >Re: Thread crashing problem (From: Ken Tozier <email@hidden>)
 >Re: Thread crashing problem (From: "Kyle Sluder" <email@hidden>)
 >Re: Thread crashing problem (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: Thread crashing problem
  • Next by Date: Configuring NSNumberFormatter non-programmatically
  • Previous by thread: Re: Thread crashing problem
  • Next by thread: Re: Thread crashing problem
  • Index(es):
    • Date
    • Thread