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

Dave Butenhof David.Butenhof at hp.com
Thu Jan 8 15:17:27 UTC 2004


David Abrahams wrote:

>Mathieu Lacage <Mathieu.Lacage at sophia.inria.fr> 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 at hp.com ]--------------------\
| 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 ]---/




More information about the c++-pthreads mailing list