Re: waiting for an NSThread
Re: waiting for an NSThread
- Subject: Re: waiting for an NSThread
- From: "Michael Ash" <email@hidden>
- Date: Mon, 13 Oct 2008 22:01:12 -0400
On Mon, Oct 13, 2008 at 3:20 PM, Ken Thomases <email@hidden> wrote:
> 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.
And if you must support 10.4 or below, merely register for the
notification from the thread you wish to monitor.
Mike
_______________________________________________
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