Markus Werle
Anthony Williams
writes: The problem is that the static boost thread library tries to hook the native win32 PE TLS callbacks in order to ensure that the thread-local data used by boost thread is cleaned up correctly. This is not compatible with a C++/CLI executable.
So the auto-link feature should be switched off in C++/CLI, right?
Maybe. Alternatively, it should force the use of the thread DLL rather than static lib.
Your workaround explicitly omits the automatic TLS cleanup (and declares that you're doing it yourself by calling on_thread_exit at the appropriate time).
I am lost here.
Boost.Thread uses some TLS variables for things like the current thread ID, interruption handles and so forth. In order to ensure that these things are correctly freed when a thread exits, on_thread_exit must be called when a thread exits. For the DLL build of Boost.Thread, this is done in the DLL_THREAD_DETACH handler. For the static lib, it hooks the win32 executable TLS callback to do this. If you provide tss_cleanup_implemented() you are declaring that you are going to do this yourself somehow (e.g. as part of the thread function).
Could you eventually provide some Good (TM) workaround and advice for this?
Link against the Boost.Thread DLL. Build your app with BOOST_THREAD_USE_DLL defined to force the auto-link to choose this, and ensure that the code is compatible. Anthony -- Author of C++ Concurrency in Action | http://www.manning.com/williams just::thread C++0x thread library | http://www.stdthread.co.uk Just Software Solutions Ltd | http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976