]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/asio/detail/impl/strand_executor_service.ipp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / detail / impl / strand_executor_service.ipp
index ae27352569b29b4b0e6f0cec63a16cd5aceccad5..70d72e2b809fa44b6dc246e5d881894d5e64a727 100644 (file)
@@ -2,7 +2,7 @@
 // detail/impl/strand_executor_service.ipp
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -127,6 +127,30 @@ bool strand_executor_service::running_in_this_thread(
   return !!call_stack<strand_impl>::contains(impl.get());
 }
 
+bool strand_executor_service::push_waiting_to_ready(implementation_type& impl)
+{
+  impl->mutex_->lock();
+  impl->ready_queue_.push(impl->waiting_queue_);
+  bool more_handlers = impl->locked_ = !impl->ready_queue_.empty();
+  impl->mutex_->unlock();
+  return more_handlers;
+}
+
+void strand_executor_service::run_ready_handlers(implementation_type& impl)
+{
+  // Indicate that this strand is executing on the current thread.
+  call_stack<strand_impl>::context ctx(impl.get());
+
+  // Run all ready handlers. No lock is required since the ready queue is
+  // accessed only within the strand.
+  boost::system::error_code ec;
+  while (scheduler_operation* o = impl->ready_queue_.front())
+  {
+    impl->ready_queue_.pop();
+    o->complete(impl.get(), ec, 0);
+  }
+}
+
 } // namespace detail
 } // namespace asio
 } // namespace boost