Boost
C++ Libraries
...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
This is an older version of Boost and was released in 2023. The current version is 1.90.0.
The signal set type when rebound to the specified executor.
typedef basic_signal_set< Executor1 > other;
|
Name |
Description |
|---|---|
|
Rebinds the signal set type to another executor. |
|
|
The type of the executor associated with the object. |
|
|
Enumeration representing the different types of flags that may specified when adding a signal to a set. |
|
|
Portability typedef. |
|
Name |
Description |
|---|---|
|
Add a signal to a signal_set. |
|
|
Start an asynchronous operation to wait for a signal to be delivered. |
|
|
basic_signal_set [constructor] |
Construct a signal set without adding any signals. |
|
Cancel all operations associated with the signal set. |
|
|
Remove all signals from a signal_set. |
|
|
Get the executor associated with the object. |
|
|
Remove a signal from a signal_set. |
|
|
~basic_signal_set [destructor] |
Destroys the signal set. |
The basic_signal_set class provides
the ability to perform an asynchronous wait for one or more signals to
occur.
Distinct objects: Safe.
Shared objects: Unsafe.
Performing an asynchronous wait:
void handler( const boost::system::error_code& error, int signal_number) { if (!error) { // A signal occurred. } } ... // Construct a signal set registered for process termination. boost::asio::signal_set signals(my_context, SIGINT, SIGTERM); // Start an asynchronous wait for one of the signals to occur. signals.async_wait(handler);
If a signal is registered with a signal_set, and the signal occurs when there are no waiting handlers, then the signal notification is queued. The next async_wait operation on that signal_set will dequeue the notification. If multiple notifications are queued, subsequent async_wait operations dequeue them one at a time. Signal notifications are dequeued in order of ascending signal number.
If a signal number is removed from a signal_set (using the remove or erase
member functions) then any queued notifications for that signal are discarded.
The same signal number may be registered with different signal_set objects. When the signal occurs, one handler is called for each signal_set object.
Note that multiple registration only works for signals that are registered
using Asio. The application must not also register a signal handler using
functions such as signal() or sigaction().
POSIX allows signals to be blocked using functions such as sigprocmask()
and pthread_sigmask().
For signals to be delivered, programs must ensure that any signals registered
using signal_set objects are unblocked in at least one thread.
Header: boost/asio/basic_signal_set.hpp
Convenience header: boost/asio.hpp