25#ifndef LELY_IO2_TIMER_H_
26#define LELY_IO2_TIMER_H_
33#ifndef LELY_IO_TIMER_INLINE
34#define LELY_IO_TIMER_INLINE static inline
65#define IO_TIMER_WAIT_INIT(exec, func) \
67 EV_TASK_INIT(exec, func), { 0, 0 } \
234 return (*timer)->get_dev(timer);
240 return (*timer)->get_clock(timer);
246 return (*timer)->getoverrun(timer);
252 return (*timer)->gettime(timer, value);
259 return (*timer)->settime(timer, flags, value, ovalue);
265 (*timer)->submit_wait(timer, wait);
This header file is part of the I/O library; it contains the abstract clock interface.
const struct io_clock_vtbl *const io_clock_t
An abstract clock.
This header file is part of the event library; it contains the futures and promises declarations.
const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
int io_timer_settime(io_timer_t *timer, int flags, const struct itimerspec *value, struct itimerspec *ovalue)
Arms or disarms an I/O timer.
static ev_exec_t * io_timer_get_exec(const io_timer_t *timer)
const struct io_timer_vtbl *const io_timer_t
An abstract timer.
static size_t io_timer_abort_wait(io_timer_t *timer, struct io_timer_wait *wait)
Aborts the specified I/O timer wait operation if it is pending.
static size_t io_timer_cancel(io_timer_t *timer, struct ev_task *task)
static size_t io_timer_cancel_wait(io_timer_t *timer, struct io_timer_wait *wait)
Cancels the specified I/O timer wait operation if it is pending.
io_clock_t * io_timer_get_clock(const io_timer_t *timer)
Returns a pointer to the clock used by the timer.
io_dev_t * io_timer_get_dev(const io_timer_t *timer)
Returns a pointer to the abstract I/O device representing the timer.
void io_timer_submit_wait(io_timer_t *timer, struct io_timer_wait *wait)
Submits a wait operation to an I/O timer.
static size_t io_timer_abort(io_timer_t *timer, struct ev_task *task)
static io_ctx_t * io_timer_get_ctx(const io_timer_t *timer)
struct io_timer_wait * io_timer_wait_from_task(struct ev_task *task)
Obtains a pointer to an I/O timer wait operation from a pointer to its completion task.
int io_timer_getoverrun(const io_timer_t *timer)
Obtains the I/O timer expiration overrun count of the last successfully processed expiration.
int io_timer_gettime(const io_timer_t *timer, struct itimerspec *value)
Obtains the amount of time until the specified I/O timer expires and the reload value of the timer.
This header file is part of the I/O library; it contains the abstract I/O device interface.
size_t io_dev_abort(io_dev_t *dev, struct ev_task *task)
Aborts the asynchronous operation submitted to *dev, if its task has not yet been submitted to its ex...
const struct io_dev_vtbl *const io_dev_t
An abstract I/O device.
io_ctx_t * io_dev_get_ctx(const io_dev_t *dev)
Returns a pointer to the I/O context with which the I/O device is registered.
size_t io_dev_cancel(io_dev_t *dev, struct ev_task *task)
Cancels the asynchronous operation submitted to *dev, if its task has not yet been submitted to its e...
ev_exec_t * io_dev_get_exec(const io_dev_t *dev)
Returns a pointer to the executor used by the I/O device to execute asynchronous tasks.
The result of an I/O timer wait operation.
int errc
The error number, obtained as if by get_errc(), if result is -1.
int result
The result of the wait operation: the expiration overrun count (see io_timer_getoverrun()) on success...
A wait operation suitable for use with an I/O timer.
struct io_timer_wait_result r
The result of the wait operation.
struct ev_task task
The task (to be) submitted upon completion (or cancellation) of the wait operation.
A struct specifying an interval and initial value for a timer.
This header file is part of the event library; it contains the task declarations.