// detail/kqueue_reactor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2005 Stefan Arentz (stefan at soze dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
+#include <boost/asio/detail/conditionally_enabled_mutex.hpp>
#include <boost/asio/detail/limits.hpp>
-#include <boost/asio/detail/mutex.hpp>
#include <boost/asio/detail/object_pool.hpp>
#include <boost/asio/detail/op_queue.hpp>
#include <boost/asio/detail/reactor_op.hpp>
+#include <boost/asio/detail/scheduler_task.hpp>
#include <boost/asio/detail/select_interrupter.hpp>
#include <boost/asio/detail/socket_types.hpp>
#include <boost/asio/detail/timer_queue_base.hpp>
class scheduler;
class kqueue_reactor
- : public execution_context_service_base<kqueue_reactor>
+ : public execution_context_service_base<kqueue_reactor>,
+ public scheduler_task
{
private:
// The mutex type used by this reactor.
per_descriptor_data& source_descriptor_data);
// Post a reactor operation for immediate completion.
- void post_immediate_completion(reactor_op* op, bool is_continuation)
- {
- scheduler_.post_immediate_completion(op, is_continuation);
- }
+ void post_immediate_completion(operation* op, bool is_continuation);
// Start a new operation. The reactor operation will be performed when the
// given descriptor is flagged as ready, or an error has occurred.
BOOST_ASIO_DECL void cancel_ops(socket_type descriptor,
per_descriptor_data& descriptor_data);
+ // Cancel all operations associated with the given descriptor and key. The
+ // handlers associated with the descriptor will be invoked with the
+ // operation_aborted error.
+ BOOST_ASIO_DECL void cancel_ops_by_key(socket_type descriptor,
+ per_descriptor_data& descriptor_data,
+ int op_type, void* cancellation_key);
+
// Cancel any operations that are running against the descriptor and remove
// its registration from the reactor. The reactor resources associated with
// the descriptor must be released by calling cleanup_descriptor_data.
typename timer_queue<Time_Traits>::per_timer_data& timer,
std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)());
+ // Cancel the timer operations associated with the given key.
+ template <typename Time_Traits>
+ void cancel_timer_by_key(timer_queue<Time_Traits>& queue,
+ typename timer_queue<Time_Traits>::per_timer_data* timer,
+ void* cancellation_key);
+
// Move the timer operations associated with the given timer.
template <typename Time_Traits>
void move_timer(timer_queue<Time_Traits>& queue,