[c++-pthreads] pthread_cancel and EH: let's try this again

Gabriel Dos Reis gdr at integrable-solutions.net
Mon Jul 18 22:38:01 UTC 2005


Nathan Myers <ncm at cantrip.org> writes:

| On Mon, Jul 18, 2005 at 08:17:29PM +0300, Peter Dimov wrote:
| > Ted Baker wrote:
| > >On Mon, Jul 18, 2005 at 06:53:23PM +0300, Peter Dimov wrote:
| > >>I'm not sure I follow. In what way is a cancellation exception less
| > >>safe than any other exception?
| > >
| > >In this context, I was thinking of the problem of not knowing when
| > >and where such an exception might be thrown.  As others have
| > >pointed out, when you are calling a library function written
| > >in C (whether part of the standard C library or some other library)
| > >you don't know whether it will call something that qualifies as
| > >a thread cancellation point.  This is a problem with C, already,
| > >and wrapping it in C++ does not make the problem go away.
| > 
| > In other words, the answer is a qualified "none".
| > 
| > When you are calling a function written in C++ you don't know whether it 
| > will throw unless this is documented.
| 
| To have cancellation exceptions come from C functions breaks all code 
| that was written assuming C functions don't throw: i.e., all existing 
| C++ code that calls C functions.

This is clear exaggeration.

-- Gaby



More information about the c++-pthreads mailing list