Lely core libraries 2.3.4
tqueue.h
Go to the documentation of this file.
1
26#ifndef LELY_IO2_TQUEUE_H_
27#define LELY_IO2_TQUEUE_H_
28
29#include <lely/io2/timer.h>
30#include <lely/util/pheap.h>
31
33typedef struct io_tqueue io_tqueue_t;
34
43 struct ev_task task;
48 int errc;
49 struct pnode _node;
50};
51
53#define IO_TQUEUE_WAIT_INIT(sec, nsec, exec, func) \
54 { \
55 { (sec), (nsec) }, EV_TASK_INIT(exec, func), 0, PNODE_INIT \
56 }
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
62void *io_tqueue_alloc(void);
63void io_tqueue_free(void *ptr);
64io_tqueue_t *io_tqueue_init(
65 io_tqueue_t *tq, io_timer_t *timer, ev_exec_t *exec);
66void io_tqueue_fini(io_tqueue_t *tq);
67
81
84
87
90
97
107size_t io_tqueue_cancel_wait(io_tqueue_t *tq, struct io_tqueue_wait *wait);
108
117size_t io_tqueue_abort_wait(io_tqueue_t *tq, struct io_tqueue_wait *wait);
118
136 const struct timespec *value, struct io_tqueue_wait **pwait);
137
143
144#ifdef __cplusplus
145}
146#endif
147
148#endif // !LELY_IO2_TQUEUE_H_
const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
Definition ev.h:29
This header file is part of the I/O library; it contains the abstract timer interface.
const struct io_timer_vtbl *const io_timer_t
An abstract timer.
Definition timer.h:38
const struct io_dev_vtbl *const io_dev_t
An abstract I/O device.
Definition dev.h:35
This header file is part of the utilities library; it contains the pairing heap declarations.
A future.
Definition future.c:66
An executable task.
Definition task.h:41
A wait operation suitable for use with a timer queue.
Definition tqueue.h:36
struct ev_task task
The task (to be) submitted upon completion (or cancellation) of the wait operation.
Definition tqueue.h:43
int errc
The error number, obtained as if by get_errc(), if an error occurred or the operation was canceled.
Definition tqueue.h:48
struct timespec value
The absolute expiration time.
Definition tqueue.h:38
A node in a pairing heap.
Definition pheap.h:52
A time type with nanosecond resolution.
Definition time.h:88
void io_tqueue_destroy(io_tqueue_t *tq)
Destroys a timer queue.
Definition tqueue.c:211
struct io_tqueue_wait * io_tqueue_wait_from_task(struct ev_task *task)
Obtains a pointer to a timer queue wait operation from a pointer to its completion task.
Definition tqueue.c:358
size_t io_tqueue_abort_wait(io_tqueue_t *tq, struct io_tqueue_wait *wait)
Aborts the specified timer queue wait operation if it is pending.
Definition tqueue.c:313
io_tqueue_t * io_tqueue_create(io_timer_t *timer, ev_exec_t *exec)
Creates a new timer queue.
Definition tqueue.c:184
size_t io_tqueue_cancel_wait(io_tqueue_t *tq, struct io_tqueue_wait *wait)
Cancels the specified timer queue wait operation if it is pending.
Definition tqueue.c:294
io_dev_t * io_tqueue_get_dev(const io_tqueue_t *tq)
Returns a pointer to the abstract I/O device representing the timer queue.
Definition tqueue.c:220
io_timer_t * io_tqueue_get_timer(const io_tqueue_t *tq)
Returns a pointer to the I/O timer used by the timer queue.
Definition tqueue.c:228
void io_tqueue_submit_wait(io_tqueue_t *tq, struct io_tqueue_wait *wait)
Submits a wait operation to a timer queue.
Definition tqueue.c:236