Lely core libraries 2.3.4
exec.h
Go to the documentation of this file.
1
22#ifndef LELY_EV_EXEC_H_
23#define LELY_EV_EXEC_H_
24
25#include <lely/ev/ev.h>
26
27#include <stddef.h>
28
29#ifndef LELY_EV_EXEC_INLINE
30#define LELY_EV_EXEC_INLINE static inline
31#endif
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
38 void (*on_task_init)(ev_exec_t *exec);
39 void (*on_task_fini)(ev_exec_t *exec);
40 int (*dispatch)(ev_exec_t *exec, struct ev_task *task);
41 void (*post)(ev_exec_t *exec, struct ev_task *task);
42 void (*defer)(ev_exec_t *exec, struct ev_task *task);
43 size_t (*abort)(ev_exec_t *exec, struct ev_task *task);
44 void (*run)(ev_exec_t *exec, struct ev_task *task);
45};
46
52LELY_EV_EXEC_INLINE void ev_exec_on_task_init(ev_exec_t *exec);
53
55LELY_EV_EXEC_INLINE void ev_exec_on_task_fini(ev_exec_t *exec);
56
67LELY_EV_EXEC_INLINE int ev_exec_dispatch(ev_exec_t *exec, struct ev_task *task);
68
76LELY_EV_EXEC_INLINE void ev_exec_post(ev_exec_t *exec, struct ev_task *task);
77
87LELY_EV_EXEC_INLINE void ev_exec_defer(ev_exec_t *exec, struct ev_task *task);
88
95LELY_EV_EXEC_INLINE size_t ev_exec_abort(ev_exec_t *exec, struct ev_task *task);
96
103LELY_EV_EXEC_INLINE void ev_exec_run(ev_exec_t *exec, struct ev_task *task);
104
105inline void
107{
108 (*exec)->on_task_init(exec);
109}
110
111inline void
113{
114 (*exec)->on_task_fini(exec);
115}
116
117inline int
119{
120 return (*exec)->dispatch(exec, task);
121}
122
123inline void
125{
126 (*exec)->post(exec, task);
127}
128
129inline void
131{
132 (*exec)->defer(exec, task);
133}
134
135inline size_t
137{
138 return (*exec)->abort(exec, task);
139}
140
141inline void
143{
144 (*exec)->run(exec, task);
145}
146
147#ifdef __cplusplus
148}
149#endif
150
151#endif // !LELY_EV_EXEC_H_
size_t ev_exec_abort(ev_exec_t *exec, struct ev_task *task)
Aborts the specified task submitted to *exec, if it has not yet begun executing, or all pending tasks...
Definition exec.h:136
void ev_exec_run(ev_exec_t *exec, struct ev_task *task)
Invokes the task function in *task as if the task is being executed by *exec.
Definition exec.h:142
void ev_exec_post(ev_exec_t *exec, struct ev_task *task)
Submits *task to *exec for execution.
Definition exec.h:124
void ev_exec_on_task_fini(ev_exec_t *exec)
Undoes the effect of a previous call to ev_exec_on_task_init().
Definition exec.h:112
void ev_exec_on_task_init(ev_exec_t *exec)
Indicates to the specified executor that a task will be submitted for execution in the future.
Definition exec.h:106
void ev_exec_defer(ev_exec_t *exec, struct ev_task *task)
Submits *task to *exec for execution.
Definition exec.h:130
int ev_exec_dispatch(ev_exec_t *exec, struct ev_task *task)
Submits *task to *exec for execution.
Definition exec.h:118
This is the public header file of the event library.
const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
Definition ev.h:29
This header file is part of the C11 and POSIX compatibility library; it includes <stddef....
An executable task.
Definition task.h:41
ev_exec_t * exec
A pointer to the executor to which the task is (to be) submitted.
Definition task.h:43