• 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: Exiting a cthread?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exiting a cthread?


  • Subject: Re: Exiting a cthread?
  • From: Jim Magee <email@hidden>
  • Date: Tue, 11 Apr 2006 17:12:48 -0400


On Apr 11, 2006, at 4:46 PM, Tomas Zahradnicky wrote:
my app creates a two threads in a remote context and I'd like to ask what's the proper way to have cthread "commit suicide" to not cause resource leaks when I'm finished with it.

Is OK to call

  thread_terminate( mach_thread_self() );

from that cthread and expect nothing more to be executed beyond that point?

Darwin doesn't really use cthreads (we use pthreads over Mach threads), so I assume this question is about a Mach thread. That call, called from the thread itself, will get rid of the Mach thread resources for the thread and one send right for the Mach port representing the thread. But it won't handle reaping any of the other user-level resources like a stack, etc... You will have to handle those resources from outside the thread (since the thread will need its stack to make that call).


--Jim

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Exiting a cthread? (From: Tomas Zahradnicky <email@hidden>)

  • Prev by Date: Exiting a cthread?
  • Next by Date: Fwd: kqueue issues
  • Previous by thread: Exiting a cthread?
  • Next by thread: Fwd: kqueue issues
  • Index(es):
    • Date
    • Thread