]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/thread/example/scoped_thread.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / thread / example / scoped_thread.cpp
index d345651c11c2c316f1107484e06e166ebad49b21..9242f580349426a62ded3370cc497c4e64d37453 100644 (file)
@@ -39,36 +39,23 @@ void do_something_in_current_thread()
 {
 }
 
-//void do_something_with_current_thread(boost::thread&& th)
-//{
-//  th.join();
-//}
-
 int main()
 {
   {
-    int some_local_state;
+    int some_local_state=0;
     boost::strict_scoped_thread<> t( (boost::thread(func(some_local_state))));
 
     do_something_in_current_thread();
   }
   {
-    int some_local_state;
+    int some_local_state=0;
     boost::thread t(( func(some_local_state) ));
     boost::strict_scoped_thread<> g( (boost::move(t)) );
 
     do_something_in_current_thread();
   }
-//  {
-//    int some_local_state;
-//    boost::thread t(( func(some_local_state) ));
-//    boost::strict_scoped_thread<> g( (boost::move(t)) );
-//
-//    do_something_in_current_thread();
-//    do_something_with_current_thread(boost::thread(g));
-//  }
   {
-    int some_local_state;
+    int some_local_state=0;
     boost::scoped_thread<> t( (boost::thread(func(some_local_state))));
 
     if (t.joinable())
@@ -76,14 +63,17 @@ int main()
     else
       do_something_in_current_thread();
   }
+#if 0
   {
-    int some_local_state;
+    int some_local_state=0;
     boost::thread t(( func(some_local_state) ));
     boost::scoped_thread<> g( (boost::move(t)) );
-    t.detach();
+    if (g.joinable())
+      g.detach();
 
     do_something_in_current_thread();
   }
+#endif
   {
     boost::scoped_thread<> g( &f, 1, 2 );
     do_something_in_current_thread();