boost::corosio::signal_set
An asynchronous signal set for coroutine I/O.
Synopsis
Declared in <boost/corosio/signal_set.hpp>
class signal_set
: public io_signal_set
Description
This class provides the ability to perform an asynchronous wait for one or more signals to occur. The signal set registers for signals using sigaction() on POSIX systems or the C runtime signal() function on Windows.
Thread Safety
Distinct objects: Safe. Shared objects: Unsafe. A signal_set must not have concurrent wait operations.
Semantics
Wraps platform signal handling (sigaction on POSIX, C runtime signal() on Windows). Operations dispatch to OS signal APIs via the io_context reactor.
Supported Signals
On Windows, the following signals are supported: SIGINT, SIGTERM, SIGABRT, SIGFPE, SIGILL, SIGSEGV.
Example
signal_set signals(ctx, SIGINT, SIGTERM);
auto [ec, signum] = co_await signals.wait();
if (ec == capy::cond::canceled)
{
// Operation was cancelled via stop_token or cancel()
}
else if (!ec)
{
std::cout << "Received signal " << signum << std::endl;
}
Types
Name |
Description |
RAII wrapper for I/O object implementation lifetime. |
|
Define backend hooks for signal set operations. |
|
Service interface for I/O object lifecycle management. |
Member Functions
Name |
Description |
|
Constructors |
|
Destructor. |
|
Move assignment operator. |
|
|
Cancel all operations associated with the signal set. |
|
Remove all signals from the signal set. |
|
Return the execution context. |
|
Remove a signal from the signal set. |
|
Wait for a signal to be delivered. |
Protected Member Functions
Name |
Description |
|
Construct from |
|
Assignment operators |
|
Dispatch cancel to the concrete implementation. |
Protected Static Member Functions
Name |
Description |
Create a handle bound to a service found in the context. |
Friends
Name |
Description |
Bitwise NOT (complement). |
|
Compound assignment AND. |
|
Compound assignment OR. |
|
Mask two flag values. |
|
Combine two flag values. |
Derived Classes
Name |
Description |
An asynchronous signal set with devirtualized wait operations. |
Created with MrDocs