Re: basic threading question: if parent thread completes
Re: basic threading question: if parent thread completes
- Subject: Re: basic threading question: if parent thread completes
- From: Jean-Daniel Dupas <email@hidden>
- Date: Fri, 18 Sep 2009 00:43:14 +0200
Le 18 sept. 2009 à 00:32, Stephen J. Butler a écrit :
On Thu, Sep 17, 2009 at 5:23 PM, Nick Rogers <email@hidden> wrote:
Hi,
I need to know this before going in for changes that are too complex.
I spawned a thread from AppController (thread1).
From thread1, I spawn another thread2.
thread1 completes.
Will thread2 terminate, give rise to anything else, or just keep on
working
usually?
Continue working; with the exception of the main thread, of course.
When the main thread terminates, the program exists, so all other
running threads are terminated/canceled/exited/whatever term you want
to use.
Note that you can terminate the main thread (or any other thread)
without affecting other threads by using the pthread_exit() function.
Note if you're using pthreads directly: all threads created should
eventually be joined on some thread (doesn't have to be the creator).
If you never intend to call pthread_join() on a thread, then call
pthread_detach().
-- Jean-Daniel
_______________________________________________
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