Re: [SPAM] - Re: [c++-pthreads] Re: FW: RE: Re: I'm Lost - Email found in subject
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [SPAM] - Re: [c++-pthreads] Re: FW: RE: Re: I'm Lost - Email found in subject
- To: Dave Butenhof <david.butenhof@xxxxxx>
- Subject: Re: [SPAM] - Re: [c++-pthreads] Re: FW: RE: Re: I'm Lost - Email found in subject
- From: Ted Baker <baker@xxxxxxxxxx>
- Date: Thu, 9 Mar 2006 07:10:14 -0500
> >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