• 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: Problem killing my threads :)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Problem killing my threads :)
      • From: Sherm Pendley <email@hidden>
References: 
 >Re: Problem killing my threads :) (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Request for comments: archive for mailing lists
  • Next by Date: Re: Displaying sheet when window first appears.
  • Previous by thread: Re: Problem killing my threads :)
  • Next by thread: Re: Problem killing my threads :)
  • Index(es):
    • Date
    • Thread