pthread_exit() called when a cleanup handler is installed

Lorin Hochstein lmh@xiphos.ca
Tue Jul 6 10:53:00 GMT 1999


In my code, when calling pthread_exit(), the installed cleanup functions
do NOT execute. They do execute if I call:

pthread_cancel(pthread_self());
pthread_testcancel();

I'm using the Microsoft compiler with C code, so I end up using the
WIN32 SEH version of cancel cleanup. This uses the Microsoft __try and
__finally blocks for pthread_clean_push and pthread_cleanup_pop, and
uses _endthreadex for pthread_exit.

I'm not 100% sure, but I believe that calling _endthreadex will NOT
cause the code in a "finally" statement to be executed. A fix would
require some change to the pthread.h file (perhaps doing away with WIN32
structured exception handling altogether...?)

Lorin Hochstein


More information about the Pthreads-win32 mailing list