Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66518 - trunk/libs/thread/src/win32
From: anthony_at_[hidden]
Date: 2010-11-12 04:11:25


Author: anthonyw
Date: 2010-11-12 04:11:22 EST (Fri, 12 Nov 2010)
New Revision: 66518
URL: http://svn.boost.org/trac/boost/changeset/66518

Log:
Better fix for #4736 --- ensure we have tried to allocate TLS value
before complaining that it's not there, especially in native threads

Text files modified:
   trunk/libs/thread/src/win32/thread.cpp | 16 +++++++++++-----
   1 files changed, 11 insertions(+), 5 deletions(-)

Modified: trunk/libs/thread/src/win32/thread.cpp
==============================================================================
--- trunk/libs/thread/src/win32/thread.cpp (original)
+++ trunk/libs/thread/src/win32/thread.cpp 2010-11-12 04:11:22 EST (Fri, 12 Nov 2010)
@@ -58,6 +58,8 @@
             boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key);
             if(current_thread_tls_key)
                 BOOST_VERIFY(TlsSetValue(current_thread_tls_key,new_data));
+ else
+ boost::throw_exception(thread_resource_error());
         }
 
 #ifdef BOOST_NO_THREADEX
@@ -222,15 +224,19 @@
         void make_external_thread_data()
         {
             externally_launched_thread* me=detail::heap_new<externally_launched_thread>();
- set_current_thread_data(me);
+ try
+ {
+ set_current_thread_data(me);
+ }
+ catch(...)
+ {
+ detail::heap_delete(me);
+ throw;
+ }
         }
 
         detail::thread_data_base* get_or_make_current_thread_data()
         {
- if(!current_thread_tls_key)
- {
- throw thread_resource_error();
- }
             detail::thread_data_base* current_thread_data(get_current_thread_data());
             if(!current_thread_data)
             {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk