• 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: waiting for an NSThread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: waiting for an NSThread


  • Subject: Re: waiting for an NSThread
  • From: Roland King <email@hidden>
  • Date: Mon, 13 Oct 2008 12:01:01 +0800

did you try looking at the documentation for NSThread? There's an NSThreadWillExitNotification listed there, sent to the default notification center just before the thread goes out of existence when +exit is called. Earlier in the documentation it says that after detachNewThreadSelector:toTarget:withObject: is called, the detached thread is exited (using the exit class method) as soon as aTarget has completed executing the aSelector method. So it would seem quite likely that notification would do what you want.

John Zorko wrote:


Hello, all ...

I've another n00b Cocoa question: How can I wait for a thread to finish without depending on a flag that may be reset and set before the thread i'm waiting for has time to check it? For instance, in Win32 (i'm not saying Win32 is the best, it's just what i've the most experience in), I can ::WaitForSingleObject(thread_id). In Cocoa, once I start the new thread via NSThread detachNewThreadSelector(), how can I be sure it ended i.e. how can I wait for it to end before starting another? Can I have Cocoa notify me when a thread ends, like it notifies me when an observed property changes?

Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.com











_______________________________________________

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


_______________________________________________

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: 
 >waiting for an NSThread (From: John Zorko <email@hidden>)

  • Prev by Date: waiting for an NSThread
  • Next by Date: NSComboBox, bindings, and auto-complete, oh my!
  • Previous by thread: waiting for an NSThread
  • Next by thread: Re: waiting for an NSThread
  • Index(es):
    • Date
    • Thread