Lely core libraries
2.2.5
|
Go to the documentation of this file.
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 } \
78 int (*gettime)(
const io_timer_t *timer,
struct itimerspec *value);
80 const struct itimerspec *value,
81 struct itimerspec *ovalue);
128 const io_timer_t *timer,
struct itimerspec *value);
151 const struct itimerspec *value,
struct itimerspec *ovalue);
234 return (*timer)->get_dev(timer);
240 return (*timer)->get_clock(timer);
246 return (*timer)->getoverrun(timer);
252 return (*timer)->gettime(timer, value);
257 struct itimerspec *ovalue)
259 return (*timer)->settime(timer, flags, value, ovalue);
265 (*timer)->submit_wait(timer, wait);
284 #endif // !LELY_IO2_TIMER_H_
static io_ctx_t * io_timer_get_ctx(const io_timer_t *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.
The result of an I/O timer wait operation.
const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
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.
static ev_exec_t * io_timer_get_exec(const io_timer_t *timer)
int result
The result of the wait operation: the expiration overrun count (see io_timer_getoverrun()) on success...
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.
io_clock_t * io_timer_get_clock(const io_timer_t *timer)
Returns a pointer to the clock used by the timer.
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...
struct io_timer_wait_result r
The result of the wait operation.
ev_future_t * io_timer_async_wait(io_timer_t *timer, ev_exec_t *exec, struct io_timer_wait **pwait)
Submits an asynchronous wait operation to an I/O timer and creates a future which becomes ready once ...
static size_t io_timer_cancel(io_timer_t *timer, struct ev_task *task)
A wait operation suitable for use with an I/O timer.
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.
static size_t io_timer_abort(io_timer_t *timer, struct ev_task *task)
int errc
The error number, obtained as if by get_errc(), if result is -1.
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.
void io_timer_submit_wait(io_timer_t *timer, struct io_timer_wait *wait)
Submits a wait operation to an I/O timer.
struct ev_task task
The task (to be) submitted upon completion (or cancellation) of the wait operation.
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_settime(io_timer_t *timer, int flags, const struct itimerspec *value, struct itimerspec *ovalue)
Arms or disarms an I/O timer.
const struct io_dev_vtbl *const io_dev_t
An abstract I/O device.
const struct io_timer_vtbl *const io_timer_t
An abstract timer.
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...
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.
const struct io_clock_vtbl *const io_clock_t
An abstract clock.