]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/fiber/src/algo/shared_work.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / fiber / src / algo / shared_work.cpp
index 1790a6c3c64bd2cec542696dab97e7fbb9cd07a0..a055c1e923b4d0d172475abf6b71738bba2b3e22 100644 (file)
@@ -29,7 +29,7 @@ shared_work::awakened( context * ctx) noexcept {
         lqueue_.push_back( * ctx);
     } else {
         ctx->detach();
-        std::unique_lock< std::mutex > lk( rqueue_mtx_); /*<
+        std::unique_lock< std::mutex > lk{ rqueue_mtx_ }; /*<
                 worker fiber, enqueue on shared queue
             >*/
         rqueue_.push_back( ctx);
@@ -40,8 +40,8 @@ shared_work::awakened( context * ctx) noexcept {
 //[pick_next_ws
 context *
 shared_work::pick_next() noexcept {
-    context * ctx( nullptr);
-    std::unique_lock< std::mutex > lk( rqueue_mtx_);
+    context * ctx = nullptr;
+    std::unique_lock< std::mutex > lk{ rqueue_mtx_ };
     if ( ! rqueue_.empty() ) { /*<
             pop an item from the ready queue
         >*/
@@ -70,11 +70,11 @@ void
 shared_work::suspend_until( std::chrono::steady_clock::time_point const& time_point) noexcept {
     if ( suspend_) {
         if ( (std::chrono::steady_clock::time_point::max)() == time_point) {
-            std::unique_lock< std::mutex > lk( mtx_);
+            std::unique_lock< std::mutex > lk{ mtx_ };
             cnd_.wait( lk, [this](){ return flag_; });
             flag_ = false;
         } else {
-            std::unique_lock< std::mutex > lk( mtx_);
+            std::unique_lock< std::mutex > lk{ mtx_ };
             cnd_.wait_until( lk, time_point, [this](){ return flag_; });
             flag_ = false;
         }
@@ -84,14 +84,14 @@ shared_work::suspend_until( std::chrono::steady_clock::time_point const& time_po
 void
 shared_work::notify() noexcept {
     if ( suspend_) {
-        std::unique_lock< std::mutex > lk( mtx_);
+        std::unique_lock< std::mutex > lk{ mtx_ };
         flag_ = true;
         lk.unlock();
         cnd_.notify_all();
     }
 }
 
-shared_work::rqueue_t shared_work::rqueue_{};
+shared_work::rqueue_type shared_work::rqueue_{};
 std::mutex shared_work::rqueue_mtx_{};
 
 }}}