boost::corosio::signal_set::wait
Wait for a signal to be delivered.
Synopsis
Declared in <boost/corosio/signal_set.hpp>
auto
wait();
Description
The operation supports cancellation via std::stop_token through the affine awaitable protocol. If the associated stop token is triggered, the operation completes immediately with an error that compares equal to capy::cond::canceled.
Example
signal_set signals(ctx, SIGINT);
auto [ec, signum] = co_await signals.wait();
if (ec == capy::cond::canceled)
{
// Cancelled via stop_token or cancel()
co_return;
}
if (ec)
{
// Handle other errors
co_return;
}
// Process signal
std::cout << "Received signal " << signum << std::endl;
Return Value
An awaitable that completes with io_result<int>. Returns the signal number when a signal is delivered, or an error code on failure. Compare against error conditions (e.g., ec == capy::cond::canceled) rather than error codes.
Created with MrDocs