
Peter Dimov wrote: [snip]
It seems that the static destructors are being run after on_thread_exit for the main thread; that's pretty odd.
Perhaps this is just due to some implementation details/limitation under the complex TSS implementation for static Boost.Thread under Win32.
I see some logic in tss.cpp that looks like it should handle the case of ordering/race issues between ~thread_specific_ptr and the thread exit cleanup, but the code is too complicated to tell. Maybe you need to instrument tss.cpp and tss_hooks.cpp to see what is being called and when.
I've put in some more time into studying the details of tss(_hooks|_pe|).cpp and I can only agree with you about that the problem should not occur. As I mentioned the call stack looks a bit weird from the release build, which perhaps could indicate memory corruption somewhere else in the program (instead of symbol problems). Wild guess, but I'll still have to dig even deeper into the problem. / Johan