Lely core libraries 2.3.4
sigset.h File Reference

This header file is part of the I/O library; it contains the abstract signal handler interface. More...

#include <lely/ev/future.h>
#include <lely/ev/task.h>
#include <lely/io2/dev.h>
#include <signal.h>
Include dependency graph for sigset.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  io_sigset_wait
 A wait operation suitable for use with a signal handler. More...
 
struct  io_sigset_vtbl
 

Macros

#define IO_SIGSET_WAIT_INIT(exec, func)
 The static initializer for io_sigset_wait.
 

Typedefs

typedef const struct io_sigset_vtbl *const io_sigset_t
 An abstract signal handler.
 

Functions

static io_ctx_tio_sigset_get_ctx (const io_sigset_t *sigset)
 
static ev_exec_tio_sigset_get_exec (const io_sigset_t *sigset)
 
static size_t io_sigset_cancel (io_sigset_t *sigset, struct ev_task *task)
 
static size_t io_sigset_abort (io_sigset_t *sigset, struct ev_task *task)
 
io_dev_tio_sigset_get_dev (const io_sigset_t *sigset)
 Returns a pointer to the abstract I/O device representing the signal handler.
 
int io_sigset_clear (io_sigset_t *sigset)
 Clears the set of signals being monitored by a signal handler. More...
 
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. More...
 
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. More...
 
void io_sigset_submit_wait (io_sigset_t *sigset, struct io_sigset_wait *wait)
 Submits a wait operation to a signal handler. More...
 
static size_t io_sigset_cancel_wait (io_sigset_t *sigset, struct io_sigset_wait *wait)
 Cancels the specified signal wait operation if it is pending. More...
 
static size_t io_sigset_abort_wait (io_sigset_t *sigset, struct io_sigset_wait *wait)
 Aborts the specified signal wait operation if it is pending. More...
 
ev_future_tio_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 once the wait operation completes (or is canceled). More...
 
struct io_sigset_waitio_sigset_wait_from_task (struct ev_task *task)
 Obtains a pointer to a signal wait operation from a pointer to its completion task.
 

Detailed Description

This header file is part of the I/O library; it contains the abstract signal handler interface.

Author
J. S. Seldenthuis jseld.nosp@m.enth.nosp@m.uis@l.nosp@m.ely..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file sigset.h.

Function Documentation

◆ io_sigset_get_ctx()

static io_ctx_t * io_sigset_get_ctx ( const io_sigset_t sigset)
inlinestatic
See also
io_dev_get_ctx()

Definition at line 175 of file sigset.h.

◆ io_sigset_get_exec()

static ev_exec_t * io_sigset_get_exec ( const io_sigset_t sigset)
inlinestatic
See also
io_dev_get_exec()

Definition at line 181 of file sigset.h.

◆ io_sigset_cancel()

static size_t io_sigset_cancel ( io_sigset_t sigset,
struct ev_task task 
)
inlinestatic
See also
io_dev_cancel()

Definition at line 187 of file sigset.h.

◆ io_sigset_abort()

static size_t io_sigset_abort ( io_sigset_t sigset,
struct ev_task task 
)
inlinestatic
See also
io_dev_abort()

Definition at line 193 of file sigset.h.

◆ io_sigset_clear()

int io_sigset_clear ( io_sigset_t sigset)
inline

Clears the set of signals being monitored by a signal handler.

Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
io_sigset_insert(), io_sigset_remove()

Definition at line 205 of file sigset.h.

◆ io_sigset_insert()

int io_sigset_insert ( io_sigset_t sigset,
int  signo 
)
inline

Insert the specified signal number into the set of signals being monitored by a signal handler.

Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
io_sigset_clear(), io_sigset_remove()

Definition at line 211 of file sigset.h.

◆ io_sigset_remove()

int io_sigset_remove ( io_sigset_t sigset,
int  signo 
)
inline

Removes the specified signal number from the set of signals being monitored by a signal handler.

Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
io_sigset_clear(), io_sigset_insert()

Definition at line 217 of file sigset.h.

◆ io_sigset_submit_wait()

void io_sigset_submit_wait ( io_sigset_t sigset,
struct io_sigset_wait wait 
)
inline

Submits a wait operation to a signal handler.

The completion task is submitted for execution once a signal is caught.

Definition at line 223 of file sigset.h.

◆ io_sigset_cancel_wait()

static size_t io_sigset_cancel_wait ( io_sigset_t sigset,
struct io_sigset_wait wait 
)
inlinestatic

Cancels the specified signal wait operation if it is pending.

The completion task is submitted for execution with signo = 0.

Returns
1 if the operation was canceled, and 0 if it was not pending.
See also
io_dev_cancel()

Definition at line 229 of file sigset.h.

◆ io_sigset_abort_wait()

static size_t io_sigset_abort_wait ( io_sigset_t sigset,
struct io_sigset_wait wait 
)
inlinestatic

Aborts the specified signal wait operation if it is pending.

If aborted, the completion task is not submitted for execution.

Returns
1 if the operation was aborted, and 0 if it was not pending.
See also
io_dev_abort()

Definition at line 235 of file sigset.h.

◆ io_sigset_async_wait()

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 once the wait operation completes (or is canceled).

The result of the future is an int containing the signal number, or 0 if the wait operation was canceled.

Parameters
sigseta pointer to a signal handler.
execa pointer to the executor used to execute the completion function of the wait operation. If NULL, the default executor of the signal handler is used.
pwaitthe address at which to store a pointer to the wait operation (can be NULL).
Returns
a pointer to a future, or NULL on error. In the latter case, the error number can be obtained with get_errc().

Definition at line 39 of file sigset.c.