24 #ifndef LELY_IO2_SIGSET_HPP_
25 #define LELY_IO2_SIGSET_HPP_
46 auto signo = wait->signo;
48 compat::invoke(::std::move(self->func_),
signo);
51 func_(::std::forward<F>(f)) {}
58 typename ::std::decay<F>::type func_;
69 inline typename ::std::enable_if<compat::is_invocable<F, int>::value,
82 using Signature = void(
int);
93 auto signo = wait->signo;
97 func_(::std::forward<F>(f)) {}
108 operator ev_task&() & noexcept {
return task; }
117 ::std::function<Signature> func_;
132 operator io_sigset_t*()
const noexcept {
return sigset; }
136 clear(::std::error_code& ec) noexcept {
149 ::std::error_code ec;
151 if (ec) throw ::std::system_error(ec,
"clear");
156 insert(
int signo, ::std::error_code& ec) noexcept {
169 ::std::error_code ec;
171 if (ec) throw ::std::system_error(ec,
"insert");
176 remove(
int signo, ::std::error_code& ec) noexcept {
189 ::std::error_code ec;
191 if (ec) throw ::std::system_error(ec,
"remove");
209 typename ::std::enable_if<!::std::is_base_of<
212 submit_wait(
nullptr, ::std::forward<F>(f));
219 if (!future) util::throw_errc(
"async_wait");
226 return async_wait(
nullptr, pwait);
An abstract task executor. This class is a wrapper around #ev_exec_t*.
An abstract I/O device. This class is a wrapper around #io_dev_t*.
A reference to an abstract signal handler.
void submit_wait(io_sigset_wait &wait) noexcept
ev::Future< int, void > async_wait(struct io_sigset_wait **pwait=nullptr)
void clear(::std::error_code &ec) noexcept
void remove(int signo, ::std::error_code &ec) noexcept
void insert(int signo, ::std::error_code &ec) noexcept
void submit_wait(ev_exec_t *exec, F &&f)
typename ::std::enable_if<!::std::is_base_of< io_sigset_wait, typename ::std::decay< F >::type >::value >::type submit_wait(F &&f)
ev::Future< int, void > async_wait(ev_exec_t *exec, struct io_sigset_wait **pwait=nullptr)
A wait operation suitable for use with a signal handler.
SignalSetWait(ev_exec_t *exec, F &&f)
Constructs a wait operation with a completion task.
ev::Executor get_executor() const noexcept
Returns the executor to which the completion task is (to be) submitted.
SignalSetWait(F &&f)
Constructs a wait operation with a completion task.
int get_errc(void)
Returns the last (thread-specific) native error code set by a system call or library function.
void set_errc(int errc)
Sets the current (thread-specific) native error code to errc.
This header file is part of the event library; it contains the C++ interface for the futures and prom...
const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
This header file is part of the I/O library; it contains the abstract signal handler interface.
int io_sigset_insert(io_sigset_t *sigset, int signo)
Insert the specified signal number into the set of signals being monitored by a signal handler.
const struct io_sigset_vtbl *const io_sigset_t
An abstract signal handler.
void io_sigset_submit_wait(io_sigset_t *sigset, struct io_sigset_wait *wait)
Submits a wait operation to a signal handler.
int io_sigset_remove(io_sigset_t *sigset, int signo)
Removes the specified signal number from the set of signals being monitored by a signal handler.
ev_future_t * io_sigset_async_wait(io_sigset_t *sigset, ev_exec_t *exec, struct io_sigset_wait **pwait)
Submits an asynchronous wait operation to a signal handler and creates a future which becomes ready o...
struct io_sigset_wait * io_sigset_wait_from_task(struct ev_task *task)
Obtains a pointer to a signal wait operation from a pointer to its completion task.
int io_sigset_clear(io_sigset_t *sigset)
Clears the set of signals being monitored by a signal handler.
#define IO_SIGSET_WAIT_INIT(exec, func)
The static initializer for io_sigset_wait.
io_dev_t * io_sigset_get_dev(const io_sigset_t *sigset)
Returns a pointer to the abstract I/O device representing the signal handler.
const struct io_dev_vtbl *const io_dev_t
An abstract I/O device.
This header file is part of the I/O library; it contains the C++ interface for the abstract I/O devic...
::std::error_code make_error_code(SdoErrc e) noexcept
Creates an error code corresponding to an SDO abort code.
typename ::std::enable_if< compat::is_invocable< F, int >::value, detail::SignalSetWaitWrapper< F > * >::type make_signal_set_wait_wrapper(ev_exec_t *exec, F &&f)
Creates a wait operation with a completion task.
A wait operation suitable for use with a signal handler.
struct ev_task task
The task (to be) submitted upon completion (or cancellation) of the wait operation.
int signo
The signal number, or 0 if the wait operation was canceled.