[SPAM] - Re: [c++-pthreads] Re: FW: RE: Re: I'm Lost - Email found in subject

Ted Baker baker at cs.fsu.edu
Thu Mar 9 12:10:14 UTC 2006


> >Aww, c'mon.  You're seriously telling me that one thread can set the
> >"there's now an active cancellation flag" for another thread, and the
> >other thread can read it with _NO_ synchronization?  That isn't how I
> >learned things work by reading your book!
> >  
> Cancellation state is a "stash and go" transaction; all that's necessary 
> is visibility guarantees and a confidence that the storage can't go away 
> in the midst. There are lots of lock free techniques.

By the way, this is one (the main?) reason why the transition from normal
to cancelled is one-way, and the effect of cancellation is not necessarily
immediate.  That way you can maintain consistency without a lock on the bit that
says whether a thread is cancelled.  Another thread can set the cancellation
bit and the target thread some time later notices that the bit is set.  Since
the bit is never reset, there is no race condition.

--Ted



More information about the c++-pthreads mailing list