• 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 10:30:30 -0500

On Mon, Dec 22, 2008 at 10:22 AM, Ken Tozier <email@hidden> wrote:
> How would one share a lock? Should I make it a property of the class? And
> then what? According to the NSLock documentation, multiple calls to tryLock
> are a no no, so how does one determine the current state of a lock? I didn't
> see any methods like "isLocked"

Nowhere does the documentation say this.  You can't call -[NSLock
lock] multiple times, because you'll block on a lock you already have
(that's why we have recursive locks).  Otherwise -[NSLock tryLock]
would be quite useless, wouldn't it?

>From the questions you're asking, it sounds like you're going to
implement a spinlock on top of NSLock.  Don't do this.  Just use
@synchronized.

--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

  • Follow-Ups:
    • Re: Thread crashing problem
      • From: Ken Tozier <email@hidden>
References: 
 >Re: Thread crashing problem (From: Scott Ribe <email@hidden>)
 >Re: Thread crashing problem (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: Thread crashing problem
  • Next by Date: Re: Thread crashing problem
  • Previous by thread: Re: Thread crashing problem
  • Next by thread: Re: Thread crashing problem
  • Index(es):
    • Date
    • Thread