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_object
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. |
|
Forward declaration for platform‐specific implementation. |
|
Base interface for platform I/O implementations. |
|
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. |
Friends
| Name | Description |
|---|---|
Bitwise NOT (complement). |
|
Compound assignment AND. |
|
Compound assignment OR. |
|
Mask two flag values. |
|
Combine two flag values. |
Created with MrDocs