|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r70382 - in branches/release: boost boost/thread boost/thread/pthread boost/thread/win32 libs/thread libs/thread/doc libs/thread/src/win32
From: anthony_at_[hidden]
Date: 2011-03-21 18:59:41
Author: anthonyw
Date: 2011-03-21 18:59:40 EDT (Mon, 21 Mar 2011)
New Revision: 70382
URL: http://svn.boost.org/trac/boost/changeset/70382
Log:
Merged Boost.Thread changes from trunk
Properties modified:
branches/release/boost/thread/ (props changed)
branches/release/boost/thread.hpp (props changed)
branches/release/libs/thread/ (props changed)
Text files modified:
branches/release/boost/thread/pthread/condition_variable.hpp | 36 ++++++++++++++++++++++++------------
branches/release/boost/thread/win32/thread_heap_alloc.hpp | 4 ++--
branches/release/libs/thread/doc/tss.qbk | 5 +++++
branches/release/libs/thread/src/win32/thread.cpp | 7 ++++++-
4 files changed, 37 insertions(+), 15 deletions(-)
Modified: branches/release/boost/thread/pthread/condition_variable.hpp
==============================================================================
--- branches/release/boost/thread/pthread/condition_variable.hpp (original)
+++ branches/release/boost/thread/pthread/condition_variable.hpp 2011-03-21 18:59:40 EDT (Mon, 21 Mar 2011)
@@ -47,27 +47,39 @@
inline void condition_variable::wait(unique_lock<mutex>& m)
{
- thread_cv_detail::lock_on_exit<unique_lock<mutex> > guard;
- detail::interruption_checker check_for_interruption(&internal_mutex,&cond);
- guard.activate(m);
- int const res=pthread_cond_wait(&cond,&internal_mutex);
- BOOST_ASSERT(!res);
+ int res=0;
+ {
+ thread_cv_detail::lock_on_exit<unique_lock<mutex> > guard;
+ detail::interruption_checker check_for_interruption(&internal_mutex,&cond);
+ guard.activate(m);
+ res=pthread_cond_wait(&cond,&internal_mutex);
+ }
this_thread::interruption_point();
+ if(res)
+ {
+ boost::throw_exception(condition_error());
+ }
}
inline bool condition_variable::timed_wait(unique_lock<mutex>& m,boost::system_time const& wait_until)
{
thread_cv_detail::lock_on_exit<unique_lock<mutex> > guard;
- detail::interruption_checker check_for_interruption(&internal_mutex,&cond);
- guard.activate(m);
- struct timespec const timeout=detail::get_timespec(wait_until);
- int const cond_res=pthread_cond_timedwait(&cond,&internal_mutex,&timeout);
+ int cond_res;
+ {
+ detail::interruption_checker check_for_interruption(&internal_mutex,&cond);
+ guard.activate(m);
+ struct timespec const timeout=detail::get_timespec(wait_until);
+ cond_res=pthread_cond_timedwait(&cond,&internal_mutex,&timeout);
+ }
this_thread::interruption_point();
if(cond_res==ETIMEDOUT)
{
return false;
}
- BOOST_ASSERT(!cond_res);
+ if(cond_res)
+ {
+ boost::throw_exception(condition_error());
+ }
return true;
}
@@ -121,8 +133,8 @@
detail::interruption_checker check_for_interruption(&internal_mutex,&cond);
guard.activate(m);
res=pthread_cond_wait(&cond,&internal_mutex);
- this_thread::interruption_point();
}
+ this_thread::interruption_point();
if(res)
{
boost::throw_exception(condition_error());
@@ -145,8 +157,8 @@
detail::interruption_checker check_for_interruption(&internal_mutex,&cond);
guard.activate(m);
res=pthread_cond_timedwait(&cond,&internal_mutex,&timeout);
- this_thread::interruption_point();
}
+ this_thread::interruption_point();
if(res==ETIMEDOUT)
{
return false;
Modified: branches/release/boost/thread/win32/thread_heap_alloc.hpp
==============================================================================
--- branches/release/boost/thread/win32/thread_heap_alloc.hpp (original)
+++ branches/release/boost/thread/win32/thread_heap_alloc.hpp 2011-03-21 18:59:40 EDT (Mon, 21 Mar 2011)
@@ -56,7 +56,7 @@
{
namespace detail
{
- inline /*BOOST_THREAD_DECL*/ void* allocate_raw_heap_memory(unsigned size)
+ inline BOOST_THREAD_DECL void* allocate_raw_heap_memory(unsigned size)
{
void* const heap_memory=detail::win32::HeapAlloc(detail::win32::GetProcessHeap(),0,size);
if(!heap_memory)
@@ -66,7 +66,7 @@
return heap_memory;
}
- inline /*BOOST_THREAD_DECL*/ void free_raw_heap_memory(void* heap_memory)
+ inline BOOST_THREAD_DECL void free_raw_heap_memory(void* heap_memory)
{
BOOST_VERIFY(detail::win32::HeapFree(detail::win32::GetProcessHeap(),0,heap_memory)!=0);
}
Modified: branches/release/libs/thread/doc/tss.qbk
==============================================================================
--- branches/release/libs/thread/doc/tss.qbk (original)
+++ branches/release/libs/thread/doc/tss.qbk 2011-03-21 18:59:40 EDT (Mon, 21 Mar 2011)
@@ -41,6 +41,11 @@
cleaned up, that value is added to the cleanup list. Cleanup finishes when there are no outstanding instances of
`boost::thread_specific_ptr` with values.
+Note: on some platforms, cleanup of thread-specific data is not
+performed for threads created with the platform's native API. On those
+platforms such cleanup is only done for threads that are started with
+`boost::thread` unless `boost::on_thread_exit()` is called manually
+from that thread.
[section:thread_specific_ptr Class `thread_specific_ptr`]
Modified: branches/release/libs/thread/src/win32/thread.cpp
==============================================================================
--- branches/release/libs/thread/src/win32/thread.cpp (original)
+++ branches/release/libs/thread/src/win32/thread.cpp 2011-03-21 18:59:40 EDT (Mon, 21 Mar 2011)
@@ -32,7 +32,12 @@
{
tss_cleanup_implemented(); // if anyone uses TSS, we need the cleanup linked in
current_thread_tls_key=TlsAlloc();
- BOOST_ASSERT(current_thread_tls_key!=TLS_OUT_OF_INDEXES);
+ #if defined(UNDER_CE)
+ // Windows CE does not define the TLS_OUT_OF_INDEXES constant.
+ BOOST_ASSERT(current_thread_tls_key!=0xFFFFFFFF);
+ #else
+ BOOST_ASSERT(current_thread_tls_key!=TLS_OUT_OF_INDEXES);
+ #endif
}
void cleanup_tls_key()
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