
Alexander Terekhov wrote:
Momchil Velikov wrote: [...]
Alexander> What "pthreads cleanup handlers"?
The tss cleanup handler (sorry, probably the wrong name) that you pass as the second parameter to pthread_key_create.
Alexander> Do you mean TSD dtors and/or Alexander> thread cancel/exit cleanup handlers? Thread termination (unwinding Alexander> of cleanup handlers followed by TSD destruction) and program (aka Alexander> process) termination (it runs atexit() handlers and C++ destructors Alexander> for objects with static storage duration, if not abnormal) is fully Alexander> specified. Or do you mean C++ stuff "on the stack", not static Alexander> storage duration?
I meant objects with static storage duration.
I guess yes, he meant auto objects.
I'm not so sure. So, just in case: oviously, thread termination runs before process termination (on "passive" process exit). But if process is terminated "actively" then no thread cleanup is done at all.
[snip references and quote]
IMHO, one can safely assume C++ destructors will be run before cleanup handlers.
[another snip] Most of the quotes apply to thread termination cleanup handlers, not tss cleanup handlers or whatever you call them, but perhaps the same principles apply? If so, the executive summary is that I was wrong, and the order is specified? Mike