Subject: [Boost-bugs] [Boost C++ Libraries] #5837: tss_dll: does not appear to allocate TLS storage at the proper time
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-08-30 06:10:09
#5837: tss_dll: does not appear to allocate TLS storage at the proper time
--------------------------------+-------------------------------------------
Reporter: noloader@⦠| Owner:
Type: Bugs | Status: new
Milestone: To Be Determined | Component: None
Version: Boost 1.47.0 | Severity: Problem
Keywords: |
--------------------------------+-------------------------------------------
When a Windows process loads a DLL, DllMain will recieve
DLL_PROCESS_ATTACH. According to MSDN process can use the opportunity to
allocate thread storage [1]. Interestingly, on_process_enter() (and
on_thread_enter()) does not perform the initialization. Note that
on_process_enter() is the Boost routine for DLL_PROCESS_ATTACH; and
on_thread_enter() is called for DLL_THREAD_ATTACH.
From tss_hooks.cpp:
{{{
extern "C" BOOST_THREAD_DECL void on_process_enter()
{
}
}}}
and
{{{
extern "C" BOOST_THREAD_DECL void on_thread_enter()
{
}
}}}
Even more bizarre, on_thread_exit() appears to allocate the thread local
storage:
{{{
extern "C" BOOST_THREAD_DECL void on_thread_exit()
{
// Initializing tls_key here ensures its proper visibility
boost::call_once( init_tls_key, once_init_tls_key );
// Get the exit handlers list for the current thread from tls.
if( tls_key == invalid_tls_key )
{
return;
}
...
}}}
Perhaps it would be a good idea to review the MSDN documentation, and
perfom TLS initialization according to Microsoft recommendations.
[1] http://msdn.microsoft.com/en-us/library/ms682583(v=vs.85).aspx
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5837> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC