41 #ifndef LELY_EV_LOOP_H_ 42 #define LELY_EV_LOOP_H_ 50 #ifndef LELY_EV_LOOP_INLINE 51 #define LELY_EV_LOOP_INLINE static inline 61 void *ev_loop_alloc(
void);
62 void ev_loop_free(
void *ptr);
147 const struct timespec *abs_time);
172 const struct timespec *abs_time);
179 ev_loop_t *loop,
const struct timespec *abs_time);
186 ev_loop_t *loop,
const struct timespec *abs_time);
250 #endif // !LELY_EV_LOOP_H_ const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
size_t ev_loop_run_until(ev_loop_t *loop, const struct timespec *abs_time)
Equivalent to ev_loop_wait_until(loop, NULL, abs_time).
void ev_loop_destroy(ev_loop_t *loop)
Destroys a polling event loop.
size_t ev_loop_wait_until(ev_loop_t *loop, ev_future_t *future, const struct timespec *abs_time)
Equivalent to size_t n = 0; while (ev_loop_wait_one_until(loop, future, abs_time)) n += n < S...
This header file is part of the event library; it contains the abstract polling interface.
size_t ev_loop_poll_one(ev_loop_t *loop)
Equivalent to ev_loop_run_one_until(loop, NULL).
size_t ev_loop_wait_one_until(ev_loop_t *loop, ev_future_t *future, const struct timespec *abs_time)
If the event loop has pending tasks, runs a single task.
size_t ev_loop_run_one(ev_loop_t *loop)
Equivalent to ev_loop_wait_one(loop, NULL).
size_t npoll
The number of threads allowed to poll simultaneously.
ev_exec_t * ev_loop_get_exec(const ev_loop_t *loop)
Returns a pointer to the executor corresponding to the event loop.
int ev_loop_kill(ev_loop_t *loop, void *thr)
Interrupts an event loop running on the specified thread.
size_t ev_loop_wait(ev_loop_t *loop, ev_future_t *future)
Equivalent to size_t n = 0; while (ev_loop_wait_one(loop, future)) n += n < SIZE_MAX; return ...
ev_poll_t * poll
A pointer to the interface used to poll for events (can be NULL).
size_t ev_loop_wait_one(ev_loop_t *loop, ev_future_t *future)
If the event loop has pending tasks, runs a single task.
size_t ev_loop_run_one_until(ev_loop_t *loop, const struct timespec *abs_time)
Equivalent to ev_loop_wait_one_until(loop, NULL, abs_time).
void ev_loop_stop(ev_loop_t *loop)
Stops the event loop.
ev_poll_t * ev_loop_get_poll(const ev_loop_t *loop)
Returns a pointer to the polling instance used by the event loop, or NULL if the loop does not poll...
const struct ev_poll_vtbl *const ev_poll_t
The abstract polling interface.
This header file is part of the C11 and POSIX compatibility library; it includes <stddef.h> and defines any missing functionality.
void * ev_loop_self(void)
Returns the identifier of the calling thread.
int ev_loop_stopped(const ev_loop_t *loop)
Returns 1 if the event loop is stopped, and 0 if not.
This header file is part of the event library; it contains the futures and promises declarations...
ev_loop_t * ev_loop_create(ev_poll_t *poll, size_t npoll, int poll_task)
Creates a new polling event loop.
void ev_loop_restart(ev_loop_t *loop)
Restarts an event loop.
This header file is part of the C11 and POSIX compatibility library; it includes <time.h> and defines any missing functionality.
size_t ev_loop_poll(ev_loop_t *loop)
Equivalent to ev_loop_run_until(loop, NULL).
size_t ev_loop_run(ev_loop_t *loop)
Equivalent to ev_loop_wait(loop, NULL).