Re: waiting for an NSThread

2008-10-13 Thread Michael Ash
On Mon, Oct 13, 2008 at 3:20 PM, Ken Thomases <[EMAIL PROTECTED]> 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

Re: waiting for an NSThread

2008-10-13 Thread Ken Thomases
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 de

Re: waiting for an NSThread

2008-10-13 Thread Benjamin Stiglitz
> 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? Take a look at NSConditionLock in Foundation. -Ben ___ Cocoa-d

Re: waiting for an NSThread

2008-10-13 Thread Scott Ribe
Isn't there a race condition there? Can't the thread exit before the observer is added? -- Scott Ribe [EMAIL PROTECTED] http://www.killerbytes.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin

Re: waiting for an NSThread

2008-10-12 Thread Omar Qazi
Yes. NSThread *newThread = [self startTheThread]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(threadExited:) name:NSThreadWillExitNotification object:newThread]; - (void)threadExited:(NSNotification *)noti { NSLog(@"Thread exited"); } On Oct 12, 2008,

Re: waiting for an NSThread

2008-10-12 Thread Roland King
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:toTarge

waiting for an NSThread

2008-10-12 Thread John Zorko
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 exp