pthread_cancel and EH: let's try this again
Alexander Terekhov
terekhov at web.de
Sat Jul 16 16:21:04 UTC 2005
Peter Dimov wrote:
[...]
> And what is gained compared to
>
> ~X() throw()
> {
> fclose( file );
> }
>
> ?
Currently (e.g. on Tru64 or OpenVMS) it can simply abort(). ;-)
With intelligent cancel delivery (or when unwinding is caused
by thread cancel/exit) it always will perform (potentially)
"lengthy" operation... even when its "lenghty" part is not
really needed (i.e. in the case if thread cancel). The code
I've sketched is different in this respect.
>
> Not that fclose should be a cancellation point, of course.
>
> Do you mean something along the lines of
>
> ~X() throw()
> {
> try
> {
> lengthy_or_blocking_operation();
> }
> catch( ... )
> {
> }
> }
>
> where one would want to have cancellation enabled in
> lengthy_or_blocking_operation, even when ~X is called by stack unwinding?
Yup.
regards,
alexander.
More information about the c++-pthreads
mailing list