Re: Thread Cancelation
Re: Thread Cancelation
- Subject: Re: Thread Cancelation
- From: Agent M <email@hidden>
- Date: Fri, 29 Oct 2004 16:51:29 -0400
On most threading implementations, canceling a thread is a bad idea.
If a thread is sleeping or waiting on a mutex, etc, what, exactly do
you expect to happen? What happens to any memory that code in that
thread allocated? What happens to resources that that thread my have a
lock on? What happens to objects that still have positive retain
counts?
These are all accounted for by POSIX with pthread cleanup handlers or
thread-specific memory. Apparently, Darwin doesn't offer the full POSIX
functionality of pthread cancel states which means Darwin is deficient.
If it is possible to cancel an arbitrary mach thread, then it should be
possible to cancel pthreads layered on top of them. The deficiency
lies in a number of syscalls which are not cancel-safe.
Maybe this will be fixed in the next release.
¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬
AgentM
email@hidden
¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden