Re: Thread Cancelation
Re: Thread Cancelation
- Subject: Re: Thread Cancelation
- From: Sean Gilbertson <email@hidden>
- Date: Fri, 29 Oct 2004 13:21:17 -0500
Create a signal handler in the thread, and throw a signal at it when you want it to die. In the calling thread, just do a join. This should work, depending on how Darwin handles threads. If you find that Cocoa's thread implementation is lacking, you could always wrap pthread calls. Though, if those features are missing from Cocoa, that may be foreboding. But I've used pthread in OS X, and it did allow me to join, so..
On Fri, Oct 29, 2004 at 07:01:17PM +0100, Benjohn wrote:
>
>
We've just started porting our .Net application over to OS X.
>
>
We have a thread abstraction which assumes it is possible to cancel a
>
thread. If a thread is sleeping, or waiting on a semaphore or mutex, it
>
will gracefully terminate when asked. Otherwise, the thread will cancel
>
itself when it is prepared to do so.
>
>
In trying to implement our thread abstraction in OS X, we're
>
encountering "some trouble". From what we've found so far, it seems
>
that neither NSThread, nor the p_thread implementation in OS X, will
>
meet our requirements.
>
>
I'd appreciate it if someone could confirm that the thread
>
implementations in OS X do not allow cancelling of a thread that is
>
waiting on a mutex or semaphore, or is sleeping; I'm reluctant to
>
undertake a considerable rewrite, or tender my resignation, if it is
>
not entirely necessary.
>
>
Thanks very much for your time,
>
Benjohn Barnes
>
>
_______________________________________________
>
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
--
Sean Gilbertson
IT Systems/Software Developer
_______________________________________________
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