diff options
Diffstat (limited to '3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp')
-rw-r--r-- | 3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp b/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp index 1c13a9a..187c024 100644 --- a/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp +++ b/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp @@ -75,7 +75,7 @@ namespace boost { current=next; ++next; - if(current->second.func && current->second.value) + if(current->second.func && (current->second.value!=0)) { (*current->second.func)(current->second.value); } @@ -196,15 +196,14 @@ namespace boost detach(); } - detail::thread_data_ptr thread::get_thread_info() const + detail::thread_data_ptr thread::get_thread_info BOOST_PREVENT_MACRO_SUBSTITUTION () const { - lock_guard<mutex> l(thread_info_mutex); return thread_info; } void thread::join() { - detail::thread_data_ptr const local_thread_info=get_thread_info(); + detail::thread_data_ptr const local_thread_info=(get_thread_info)(); if(local_thread_info) { bool do_join=false; @@ -238,7 +237,6 @@ namespace boost local_thread_info->done_condition.notify_all(); } - lock_guard<mutex> l1(thread_info_mutex); if(thread_info==local_thread_info) { thread_info.reset(); @@ -248,7 +246,7 @@ namespace boost bool thread::timed_join(system_time const& wait_until) { - detail::thread_data_ptr const local_thread_info=get_thread_info(); + detail::thread_data_ptr const local_thread_info=(get_thread_info)(); if(local_thread_info) { bool do_join=false; @@ -285,7 +283,6 @@ namespace boost local_thread_info->done_condition.notify_all(); } - lock_guard<mutex> l1(thread_info_mutex); if(thread_info==local_thread_info) { thread_info.reset(); @@ -296,17 +293,14 @@ namespace boost bool thread::joinable() const { - return get_thread_info(); + return (get_thread_info)(); } void thread::detach() { detail::thread_data_ptr local_thread_info; - { - lock_guard<mutex> l1(thread_info_mutex); - thread_info.swap(local_thread_info); - } + thread_info.swap(local_thread_info); if(local_thread_info) { @@ -381,8 +375,6 @@ namespace boost { #if defined(PTW32_VERSION) || defined(__hpux) return pthread_num_processors_np(); -#elif defined(_GNU_SOURCE) - return get_nprocs(); #elif defined(__APPLE__) || defined(__FreeBSD__) int count; size_t size=sizeof(count); @@ -390,6 +382,8 @@ namespace boost #elif defined(BOOST_HAS_UNISTD_H) && defined(_SC_NPROCESSORS_ONLN) int const count=sysconf(_SC_NPROCESSORS_ONLN); return (count>0)?count:0; +#elif defined(_GNU_SOURCE) + return get_nprocs(); #else return 0; #endif @@ -397,7 +391,7 @@ namespace boost thread::id thread::get_id() const { - detail::thread_data_ptr const local_thread_info=get_thread_info(); + detail::thread_data_ptr const local_thread_info=(get_thread_info)(); if(local_thread_info) { return id(local_thread_info); @@ -410,13 +404,14 @@ namespace boost void thread::interrupt() { - detail::thread_data_ptr const local_thread_info=get_thread_info(); + detail::thread_data_ptr const local_thread_info=(get_thread_info)(); if(local_thread_info) { lock_guard<mutex> lk(local_thread_info->data_mutex); local_thread_info->interrupt_requested=true; if(local_thread_info->current_cond) { + boost::pthread::pthread_mutex_scoped_lock internal_lock(local_thread_info->cond_mutex); BOOST_VERIFY(!pthread_cond_broadcast(local_thread_info->current_cond)); } } @@ -424,7 +419,7 @@ namespace boost bool thread::interruption_requested() const { - detail::thread_data_ptr const local_thread_info=get_thread_info(); + detail::thread_data_ptr const local_thread_info=(get_thread_info)(); if(local_thread_info) { lock_guard<mutex> lk(local_thread_info->data_mutex); @@ -438,7 +433,7 @@ namespace boost thread::native_handle_type thread::native_handle() { - detail::thread_data_ptr const local_thread_info=get_thread_info(); + detail::thread_data_ptr const local_thread_info=(get_thread_info)(); if(local_thread_info) { lock_guard<mutex> lk(local_thread_info->data_mutex); @@ -582,11 +577,11 @@ namespace boost { if(tss_data_node* const current_node=find_tss_data(key)) { - if(cleanup_existing && current_node->func && current_node->value) + if(cleanup_existing && current_node->func && (current_node->value!=0)) { (*current_node->func)(current_node->value); } - if(func || tss_data) + if(func || (tss_data!=0)) { current_node->func=func; current_node->value=tss_data; |