Re: [c++-pthreads] Re: thread-safety definition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [c++-pthreads] Re: thread-safety definition



David Abrahams wrote:

Mathieu Lacage <Mathieu.Lacage@xxxxxxxxxxxxxxx> writes:
It looks like what everyone is trying to achieve here is a way for C++
authors to write thread-safe libraries.
I think you missed something, or maybe the main thing.  C++ authors
can already write thread-safe libraries.

What I'm trying to achieve is to allow existing thread-safe library
code that wasn't written with POSIX cancellations in mind to be used
easily in a POSIX environment.
Right. And I maintain that this is trivial AS LONG AS you can guarantee that threads running that unsafe code will never be cancelled. (This seems reasonable, since obviously threads running that code had never previously been subject to cancellation!) And it's IMPOSSIBLE if you cannot guarantee that. The code must be analyzed and corrected, point by point; and the analysis (and possibly the correction as well) is easier if cancellation is a structured exception than if it's a return status handled in various "unique" ways by each routine.

--
/--------------------[ David.Butenhof@xxxxxx ]--------------------\
| Hewlett-Packard Company       Tru64 UNIX & VMS Thread Architect |
|     My book: http://www.awl.com/cseng/titles/0-201-63392-2/     |
\----[ http://homepage.mac.com/dbutenhof/Threads/Threads.html ]---/