pthread_cancel and EH: let's try this again

Alexander Terekhov terekhov at web.de
Sat Jul 16 15:37:03 UTC 2005


Peter Dimov wrote:
[...]
> I don't get it. What is this code supposed to achieve?

It's a dtor. The logic is this:

Detect whether unwinding caused by cancel delivery is taking place

  yes:

    reassert cancellation;
    invoke fclose() -- it will throw (and most likely not flush), 
      but will close/free resources nevertheless;
    catch and finalize cancel exception;

  no:

    invoke fclose() fully prepared to hit cancel, and if canceled
    (see above) simply reassert cancellation;

regards,
alexander.




More information about the c++-pthreads mailing list