[c++-pthreads] thread-safety definition

Alexander Terekhov boo at terekhov.de
Thu Jan 8 14:43:52 UTC 2004


Dave Butenhof wrote:
[...]
> Nevertheless, async cancel CAN be used safely if you're careful, without
> disrupting ...                                                   ^^^^^^^
  ^^^^^^^^^^

Right.

> Introducing asynchronous exceptions into C++ would be pointlessly
> disruptive ...                                        ^^^^^^^^^^^
  ^^^^^^^^^^

And that's the phobia hits DRB again. 

> Even if it were supported, though, C++ is certainly free to follow the
> lead of POSIX. We designated only a very few functions to be
> async-cancel safe; and even at that I think we ended up with more than
> we really should have had. (I never really figured out why we ended up
> with pthread_cancel() being async-cancel safe, and I don't think it
> makes any sense. The guy who write the text couldn't remember either,

Could it be that the intent was to make pthread_testcancel(), not
pthread_cancel(), async-cancel-safe? ;-)

> but in the end we decided not to risk changing it.) Really, in terms of
> POSIX standard APIs, all you can do with async cancel enabled is to
> DISABLE async-cancel. I like it that way. There's no reason at all that
> ANY of the standard C++ runtime should be designated (or coded) to be
> async-cancel safe.

C++ aside for a moment, I have yet to see async-cancel-UNsafe 
implementation of, say, strlen(). Care to inspire me? TIA.

regards,
alexander.



More information about the c++-pthreads mailing list