• 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
Am I using NSConditionLock correctly?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Am I using NSConditionLock correctly?


  • Subject: Am I using NSConditionLock correctly?
  • From: Steve Weller <email@hidden>
  • Date: Sun, 9 Oct 2005 22:53:48 -0700


I am using NSConditionLock to delay the completion of a method while another thread completes. I am not sure that I am using it correctly, since my conditional lock hangs up the program.


In my worker thread I do [calculatingLock lock]; [calculatingLock unlockWithCondition:YES] when calculation starts and [calculatingLock lock]; [calculatingLock unlockWithCondition:NO] when it stops.

In my method that depends on the worker thread stopping I do [calculatingLock lockWhenCondition:NO]; [calculatingLock unlockWithCondition:NO]. The idea is that it should wait for the condition to be set to NO before continuing. It hangs at this point. If this is all correct then my problem lies elsewhere.

More information on my blog, URL below.

--
Watch me learn Cocoa  http://homepage.mac.com/bagelturf/



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Am I using NSConditionLock correctly?
      • From: jkp <email@hidden>
  • Prev by Date: Help with my stream object please
  • Next by Date: custom frameworks: dynamic link errors
  • Previous by thread: Re: Help with my stream object please {Solved}
  • Next by thread: Re: Am I using NSConditionLock correctly?
  • Index(es):
    • Date
    • Thread