[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pthreads

From: Marcus Brinkmann
Subject: Re: pthreads
Date: Sat, 27 Jul 2002 19:55:55 +0200
User-agent: Mutt/1.4i

On Sat, Jul 27, 2002 at 07:45:51PM +0200, Neal H. Walfield wrote:
> > The critical piece of the thread implementation (any one) is cancellation. 
> > This will work differently in pthreads then it works right now in
> > cthreads.
> Well sure it will work differently, but it is essentially, a
> substitution.  Right now we use, for instance, hurd_condition_wait:
>   if (hurd_condition_wait (&cond, &mutex))
>     {
>       mutex_unlock (&mutex);
>       return EINTR;
>     }
> in pthreads we will do:
>   pthread_cleanup_push (pthread_mutex_unlock, (void *) &mutex);
>   pthread_condition_wait (&cond, &mutex);
>   pthread_cleanup_pop (1);
> Or are you trying to say something else that I am just missing?

Yes.  When the cancellation handler returns, the thread is _cancelled_.  So
you need to put a lot more into clean up handlers, eg all resources that are
allocated have to be deallocated, and you have to send a reply message in
the last cancellation handler, etc.


`Rhubarb is no Egyptian god.' GNU    address@hidden
Marcus Brinkmann              The Hurd

reply via email to

[Prev in Thread] Current Thread [Next in Thread]