]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/thread/src/pthread/thread.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / thread / src / pthread / thread.cpp
index 1be5bae2eb36f6f150c1c694aa8a0e8e440c9b48..c17aca2cc4db1f7f5b4b36dee3b47dafc18cb158 100644 (file)
@@ -17,6 +17,8 @@
 #include <boost/thread/once.hpp>
 #include <boost/thread/tss.hpp>
 #include <boost/thread/future.hpp>
+#include <boost/thread/pthread/pthread_helpers.hpp>
+#include <boost/thread/pthread/pthread_mutex_scoped_lock.hpp>
 
 #ifdef __GLIBC__
 #include <sys/sysinfo.h>
@@ -27,9 +29,9 @@
 #include <unistd.h>
 #endif
 
-#if defined(__VXWORKS__) 
+#if defined(__VXWORKS__)
 #include <vxCpuLib.h>
-#endif 
+#endif
 
 #include <boost/algorithm/string/split.hpp>
 #include <boost/algorithm/string/trim.hpp>
@@ -53,11 +55,13 @@ namespace boost
                 i->second->unlock();
                 i->first->notify_all();
             }
+//#ifndef BOOST_NO_EXCEPTIONS
             for (async_states_t::iterator i = async_states_.begin(), e = async_states_.end();
                     i != e; ++i)
             {
                 (*i)->notify_deferred();
             }
+//#endif
         }
 
         struct thread_exit_callback_node
@@ -109,7 +113,7 @@ namespace boost
                                     = thread_info->tss_data.begin();
                                 if(current->second.func && (current->second.value!=0))
                                 {
-                                    (*current->second.func)(current->second.value);
+                                    (*current->second.caller)(current->second.func,current->second.value);
                                 }
                                 thread_info->tss_data.erase(current);
                             }
@@ -147,7 +151,7 @@ namespace boost
 
         boost::detail::thread_data_base* get_current_thread_data()
         {
-            boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key);
+            boost::call_once(current_thread_tls_init_flag,&create_current_thread_tls_key);
             return (boost::detail::thread_data_base*)pthread_getspecific(current_thread_tls_key);
         }
 
@@ -213,8 +217,10 @@ namespace boost
             ~externally_launched_thread() {
               BOOST_ASSERT(notify.empty());
               notify.clear();
+//#ifndef BOOST_NO_EXCEPTIONS
               BOOST_ASSERT(async_states_.empty());
               async_states_.clear();
+//#endif
             }
             void run()
             {}
@@ -466,7 +472,7 @@ namespace boost
 #   elif defined(BOOST_HAS_PTHREAD_YIELD)
             BOOST_VERIFY(!pthread_yield());
 //#   elif defined BOOST_THREAD_USES_DATETIME
-//            xtime xt;
+//            ::boost::xtime xt;
 //            xtime_get(&xt, TIME_UTC_);
 //            sleep(xt);
 //            sleep_for(chrono::milliseconds(0));
@@ -474,7 +480,7 @@ namespace boost
             mutex mx;
             unique_lock<mutex> lock(mx);
             condition_variable cond;
-            cond.do_wait_until(lock, detail::internal_platform_clock::now())
+            cond.do_wait_until(lock, detail::internal_platform_clock::now());
 #   endif
         }
     }
@@ -498,9 +504,9 @@ namespace boost
            set &= set -1;
         }
         return(i);
-  #else  
+  #else
         return (__builtin_popcount(set) );
-  #endif  
+  #endif
 #elif defined(__GLIBC__)
         return get_nprocs();
 #else
@@ -577,7 +583,7 @@ namespace boost
             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));
+                BOOST_VERIFY(!posix::pthread_cond_broadcast(local_thread_info->current_cond));
             }
         }
     }
@@ -722,11 +728,12 @@ namespace boost
         }
 
         void add_new_tss_node(void const* key,
-                              boost::shared_ptr<tss_cleanup_function> func,
+                              detail::tss_data_node::cleanup_caller_t caller,
+                              detail::tss_data_node::cleanup_func_t func,
                               void* tss_data)
         {
             detail::thread_data_base* const current_thread_data(get_or_make_current_thread_data());
-            current_thread_data->tss_data.insert(std::make_pair(key,tss_data_node(func,tss_data)));
+            current_thread_data->tss_data.insert(std::make_pair(key,tss_data_node(caller,func,tss_data)));
         }
 
         void erase_tss_node(void const* key)
@@ -739,17 +746,19 @@ namespace boost
         }
 
         void set_tss_data(void const* key,
-                          boost::shared_ptr<tss_cleanup_function> func,
+                          detail::tss_data_node::cleanup_caller_t caller,
+                          detail::tss_data_node::cleanup_func_t func,
                           void* tss_data,bool cleanup_existing)
         {
             if(tss_data_node* const current_node=find_tss_data(key))
             {
                 if(cleanup_existing && current_node->func && (current_node->value!=0))
                 {
-                    (*current_node->func)(current_node->value);
+                    (*current_node->caller)(current_node->func,current_node->value);
                 }
                 if(func || (tss_data!=0))
                 {
+                    current_node->caller=caller;
                     current_node->func=func;
                     current_node->value=tss_data;
                 }
@@ -760,7 +769,7 @@ namespace boost
             }
             else if(func || (tss_data!=0))
             {
-                add_new_tss_node(key,func,tss_data);
+                add_new_tss_node(key,caller,func,tss_data);
             }
         }
     }
@@ -773,6 +782,8 @@ namespace boost
         current_thread_data->notify_all_at_thread_exit(&cond, lk.release());
       }
     }
+
+//#ifndef BOOST_NO_EXCEPTIONS
 namespace detail {
 
     void BOOST_THREAD_DECL make_ready_at_thread_exit(shared_ptr<shared_state_base> as)
@@ -784,7 +795,7 @@ namespace detail {
       }
     }
 }
-
+//#endif
 
 
 }