[c++-pthreads] C++ and posix threads

Fergus Henderson fjh at cs.mu.oz.au
Mon Dec 22 15:07:47 UTC 2003


On 22-Dec-2003, Jean-Marc Bourguet <jm at bourguet.org> wrote:
> I feel confused.  I wonder what is the context of the discussion
> and especially the constraints or the liberties we assume from
> an implementation.  Shoult it
>    - need the collaboration of the pthread library or be implementable
>      as wrapper around an existing pthread library?
>    - allow modifications to the C interface visible from C or not?
>    - allow modifications to the C interface visible from C++ or not?

I think part of the difficulty is that the problem may be over-constrained.
Ideally, the solution would

	- not require changes to the C pthread library
	- not modify the C interface visible from C
	- not modify the C interface visible from C++
	- never result in a thread cancellation request being ignored
	- allow threads to execute arbitrary cleanup code in
	  response to a thread cancellation request
	- make exception-safe C++ code also safe for (synchronous)
	  cancellation
	- make cancellation-safe C code also exception-safe,
	  and allow propagation of C++ exceptions through cancellation-safe
	  C code
	- not introduce any new C++ language constructs or semantics
	- not introduce any new C language constructs or semantics
	- not reduce performance of any existing code
	- be simple, easy to use/understand/teach/specifiy/implement, etc.
	- probably some other goals that I've accidentally omitted/forgotten

However, it is almost certainly not possible to achieve all of these
simultaneously.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.



More information about the c++-pthreads mailing list