summaryrefslogtreecommitdiff
path: root/boost/asio/basic_signal_set.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/asio/basic_signal_set.hpp')
-rw-r--r--boost/asio/basic_signal_set.hpp81
1 files changed, 44 insertions, 37 deletions
diff --git a/boost/asio/basic_signal_set.hpp b/boost/asio/basic_signal_set.hpp
index 608bc0a6d8..3c00fa6e26 100644
--- a/boost/asio/basic_signal_set.hpp
+++ b/boost/asio/basic_signal_set.hpp
@@ -17,6 +17,8 @@
#include <boost/asio/detail/config.hpp>
+#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES)
+
#include <boost/asio/basic_io_object.hpp>
#include <boost/asio/detail/handler_type_requirements.hpp>
#include <boost/asio/detail/throw_error.hpp>
@@ -55,7 +57,7 @@ namespace asio {
* ...
*
* // Construct a signal set registered for process termination.
- * boost::asio::signal_set signals(io_service, SIGINT, SIGTERM);
+ * boost::asio::signal_set signals(io_context, SIGINT, SIGTERM);
*
* // Start an asynchronous wait for one of the signals to occur.
* signals.async_wait(handler);
@@ -99,11 +101,11 @@ public:
/**
* This constructor creates a signal set without registering for any signals.
*
- * @param io_service The io_service object that the signal set will use to
+ * @param io_context The io_context object that the signal set will use to
* dispatch handlers for any asynchronous operations performed on the set.
*/
- explicit basic_signal_set(boost::asio::io_service& io_service)
- : basic_io_object<SignalSetService>(io_service)
+ explicit basic_signal_set(boost::asio::io_context& io_context)
+ : basic_io_object<SignalSetService>(io_context)
{
}
@@ -111,20 +113,20 @@ public:
/**
* This constructor creates a signal set and registers for one signal.
*
- * @param io_service The io_service object that the signal set will use to
+ * @param io_context The io_context object that the signal set will use to
* dispatch handlers for any asynchronous operations performed on the set.
*
* @param signal_number_1 The signal number to be added.
*
* @note This constructor is equivalent to performing:
- * @code boost::asio::signal_set signals(io_service);
+ * @code boost::asio::signal_set signals(io_context);
* signals.add(signal_number_1); @endcode
*/
- basic_signal_set(boost::asio::io_service& io_service, int signal_number_1)
- : basic_io_object<SignalSetService>(io_service)
+ basic_signal_set(boost::asio::io_context& io_context, int signal_number_1)
+ : basic_io_object<SignalSetService>(io_context)
{
boost::system::error_code ec;
- this->service.add(this->implementation, signal_number_1, ec);
+ this->get_service().add(this->get_implementation(), signal_number_1, ec);
boost::asio::detail::throw_error(ec, "add");
}
@@ -132,7 +134,7 @@ public:
/**
* This constructor creates a signal set and registers for two signals.
*
- * @param io_service The io_service object that the signal set will use to
+ * @param io_context The io_context object that the signal set will use to
* dispatch handlers for any asynchronous operations performed on the set.
*
* @param signal_number_1 The first signal number to be added.
@@ -140,18 +142,18 @@ public:
* @param signal_number_2 The second signal number to be added.
*
* @note This constructor is equivalent to performing:
- * @code boost::asio::signal_set signals(io_service);
+ * @code boost::asio::signal_set signals(io_context);
* signals.add(signal_number_1);
* signals.add(signal_number_2); @endcode
*/
- basic_signal_set(boost::asio::io_service& io_service, int signal_number_1,
+ basic_signal_set(boost::asio::io_context& io_context, int signal_number_1,
int signal_number_2)
- : basic_io_object<SignalSetService>(io_service)
+ : basic_io_object<SignalSetService>(io_context)
{
boost::system::error_code ec;
- this->service.add(this->implementation, signal_number_1, ec);
+ this->get_service().add(this->get_implementation(), signal_number_1, ec);
boost::asio::detail::throw_error(ec, "add");
- this->service.add(this->implementation, signal_number_2, ec);
+ this->get_service().add(this->get_implementation(), signal_number_2, ec);
boost::asio::detail::throw_error(ec, "add");
}
@@ -159,7 +161,7 @@ public:
/**
* This constructor creates a signal set and registers for three signals.
*
- * @param io_service The io_service object that the signal set will use to
+ * @param io_context The io_context object that the signal set will use to
* dispatch handlers for any asynchronous operations performed on the set.
*
* @param signal_number_1 The first signal number to be added.
@@ -169,21 +171,21 @@ public:
* @param signal_number_3 The third signal number to be added.
*
* @note This constructor is equivalent to performing:
- * @code boost::asio::signal_set signals(io_service);
+ * @code boost::asio::signal_set signals(io_context);
* signals.add(signal_number_1);
* signals.add(signal_number_2);
* signals.add(signal_number_3); @endcode
*/
- basic_signal_set(boost::asio::io_service& io_service, int signal_number_1,
+ basic_signal_set(boost::asio::io_context& io_context, int signal_number_1,
int signal_number_2, int signal_number_3)
- : basic_io_object<SignalSetService>(io_service)
+ : basic_io_object<SignalSetService>(io_context)
{
boost::system::error_code ec;
- this->service.add(this->implementation, signal_number_1, ec);
+ this->get_service().add(this->get_implementation(), signal_number_1, ec);
boost::asio::detail::throw_error(ec, "add");
- this->service.add(this->implementation, signal_number_2, ec);
+ this->get_service().add(this->get_implementation(), signal_number_2, ec);
boost::asio::detail::throw_error(ec, "add");
- this->service.add(this->implementation, signal_number_3, ec);
+ this->get_service().add(this->get_implementation(), signal_number_3, ec);
boost::asio::detail::throw_error(ec, "add");
}
@@ -199,7 +201,7 @@ public:
void add(int signal_number)
{
boost::system::error_code ec;
- this->service.add(this->implementation, signal_number, ec);
+ this->get_service().add(this->get_implementation(), signal_number, ec);
boost::asio::detail::throw_error(ec, "add");
}
@@ -212,10 +214,10 @@ public:
*
* @param ec Set to indicate what error occurred, if any.
*/
- boost::system::error_code add(int signal_number,
- boost::system::error_code& ec)
+ BOOST_ASIO_SYNC_OP_VOID add(int signal_number, boost::system::error_code& ec)
{
- return this->service.add(this->implementation, signal_number, ec);
+ this->get_service().add(this->get_implementation(), signal_number, ec);
+ BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
}
/// Remove a signal from a signal_set.
@@ -233,7 +235,7 @@ public:
void remove(int signal_number)
{
boost::system::error_code ec;
- this->service.remove(this->implementation, signal_number, ec);
+ this->get_service().remove(this->get_implementation(), signal_number, ec);
boost::asio::detail::throw_error(ec, "remove");
}
@@ -249,10 +251,11 @@ public:
* @note Removes any notifications that have been queued for the specified
* signal number.
*/
- boost::system::error_code remove(int signal_number,
+ BOOST_ASIO_SYNC_OP_VOID remove(int signal_number,
boost::system::error_code& ec)
{
- return this->service.remove(this->implementation, signal_number, ec);
+ this->get_service().remove(this->get_implementation(), signal_number, ec);
+ BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
}
/// Remove all signals from a signal_set.
@@ -267,7 +270,7 @@ public:
void clear()
{
boost::system::error_code ec;
- this->service.clear(this->implementation, ec);
+ this->get_service().clear(this->get_implementation(), ec);
boost::asio::detail::throw_error(ec, "clear");
}
@@ -280,9 +283,10 @@ public:
*
* @note Removes all queued notifications.
*/
- boost::system::error_code clear(boost::system::error_code& ec)
+ BOOST_ASIO_SYNC_OP_VOID clear(boost::system::error_code& ec)
{
- return this->service.clear(this->implementation, ec);
+ this->get_service().clear(this->get_implementation(), ec);
+ BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
}
/// Cancel all operations associated with the signal set.
@@ -309,7 +313,7 @@ public:
void cancel()
{
boost::system::error_code ec;
- this->service.cancel(this->implementation, ec);
+ this->get_service().cancel(this->get_implementation(), ec);
boost::asio::detail::throw_error(ec, "cancel");
}
@@ -334,9 +338,10 @@ public:
* These handlers can no longer be cancelled, and therefore are passed an
* error code that indicates the successful completion of the wait operation.
*/
- boost::system::error_code cancel(boost::system::error_code& ec)
+ BOOST_ASIO_SYNC_OP_VOID cancel(boost::system::error_code& ec)
{
- return this->service.cancel(this->implementation, ec);
+ this->get_service().cancel(this->get_implementation(), ec);
+ BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
}
/// Start an asynchronous operation to wait for a signal to be delivered.
@@ -362,7 +367,7 @@ public:
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
* of the handler will be performed in a manner equivalent to using
- * boost::asio::io_service::post().
+ * boost::asio::io_context::post().
*/
template <typename SignalHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(SignalHandler,
@@ -373,7 +378,7 @@ public:
// not meet the documented type requirements for a SignalHandler.
BOOST_ASIO_SIGNAL_HANDLER_CHECK(SignalHandler, handler) type_check;
- return this->service.async_wait(this->implementation,
+ return this->get_service().async_wait(this->get_implementation(),
BOOST_ASIO_MOVE_CAST(SignalHandler)(handler));
}
};
@@ -383,4 +388,6 @@ public:
#include <boost/asio/detail/pop_options.hpp>
+#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES)
+
#endif // BOOST_ASIO_BASIC_SIGNAL_SET_HPP