|
Threads-Devel : |
Subject: [Threads-devel] disabling automatic thread-local storage cleanup
From: Sarah Tappon (sarah_tappon_at_[hidden])
Date: 2012-05-07 20:47:49
Apologies if I'm asking this question in the wrong place - tried the user
forums with no response.
We are exploring the possibility of using boost::thread (the static
library) in a DLL project that's mostly native C++ but also must include
some managed code. Since TLS callbacks are not compatible with managed
code, we are attempting to disable the automatic TLS cleanup.
I've found references to two methods of doing this:
1) Define tss_cleanup_implemented() to prevent the automatic cleanup code
from being linked in:
http://lists.boost.org/Archives/boost/2007/11/130440.php
2) Build the library without tss_pe.cpp:
http://boost.2283326.n4.nabble.com/Using-new-threads-link-issues-td2637128.html
My questions are:
1) Are these two methods functionally equivalent?
2) When I define extern "C" void tss_cleanup_implemented(void){} within my
project, I get linker errors about multiply defined symbols (LNK2005,
LNK1169) -- are there other linker settings I need to change in order for
it to work? I'm using Visual Studio 2008.
3) Once the automatic cleanup is disabled, where exactly would we need to
call on_process_enter() and on_process_exit() within our DLL project? We
would only need to call on_thread_exit() from threads launched through the
native API that use boost::thread functionality, correct?
Thanks for your help!