• 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: Ken Thomases <email@hidden>
  • Date: Mon, 13 Oct 2008 14:20:37 -0500

On Oct 13, 2008, at 9:32 AM, Scott Ribe wrote:

Isn't there a race condition there? Can't the thread exit before the
observer is added?

Well, you can register for the notification with 'nil' for the object. That registers for all thread termination notifications. You can do that before detaching the thread.


Alternatively, in 10.5 and later, you can create (alloc+init) an NSThread, register for the notification, and only then start it.

Cheers,
Ken

_______________________________________________

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: waiting for an NSThread
      • From: "Michael Ash" <email@hidden>
References: 
 >Re: waiting for an NSThread (From: Scott Ribe <email@hidden>)

  • Prev by Date: Re: waiting for an NSThread
  • Next by Date: Re: replacing carbon menu with cocoa
  • Previous by thread: Re: waiting for an NSThread
  • Next by thread: Re: waiting for an NSThread
  • Index(es):
    • Date
    • Thread