Re: Problem killing my threads :)
Re: Problem killing my threads :)
- Subject: Re: Problem killing my threads :)
- From: Dylan Neild <email@hidden>
- Date: Mon, 23 Sep 2002 09:10:53 -0400
Hi There,
This makes sense. I suppose I could just have some sort of
"threadIsRunning" and "threadShouldTerminate" variables, then check for
these variables at entry points to my routines.
Basically, my zero thread would just set "threadShouldTerminate" in all
the right places, then wait for all threads to set "threadIsRunning" in
response.
Anyone else see any reason why this might not be the best approach?
Dylan
On Monday, September 23, 2002, at 07:17 AM, Ondra Cada wrote:
On Monday, September 23, 2002, at 06:57 , Dylan Neild wrote:
...but what about _terminating_ threads with pthreads calls?
You should not kill threads. The problem is that that way you can't
ever be sure that
they are done and they're resources have been cleaned up
Anyone please correct me if I am wrong, but so far as I know, the
right way is
(a) to ask the thread so that it terminates cleanly itself;
(b) to use any normal way of communication for this request (like a
shared variable or DO or whatever you use);
(c) then just wait for the thread termination.
And, of course...
(d) if a thread contains a bug which prevents its termination, to kill
the whole task -- which would clean up all the resources properly.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.