35 static void ev_std_exec_on_task_init(
ev_exec_t *exec);
36 static void ev_std_exec_on_task_fini(
ev_exec_t *exec);
45 &ev_std_exec_on_task_init,
46 &ev_std_exec_on_task_fini,
47 &ev_std_exec_dispatch,
78 ev_std_exec_alloc(
void)
84 return exec ? &exec->exec_vptr : NULL;
88 ev_std_exec_free(
void *ptr)
91 free(ev_std_exec_from_exec(ptr));
95 ev_std_exec_init(
ev_exec_t *exec_, ev_std_exec_impl_t *impl)
97 struct ev_std_exec *exec = ev_std_exec_from_exec(exec_);
100 exec->exec_vptr = &ev_std_exec_vtbl;
114 ev_std_exec_create(ev_std_exec_impl_t *impl)
124 ev_exec_t *tmp = ev_std_exec_init(exec, impl);
134 ev_std_exec_free((
void *)exec);
144 ev_std_exec_fini(exec);
145 ev_std_exec_free((
void *)exec);
150 ev_std_exec_on_task_init(
ev_exec_t *exec_)
152 struct ev_std_exec *exec = ev_std_exec_from_exec(exec_);
154 assert((*exec->impl)->on_task_init);
156 (*exec->impl)->on_task_init(exec->impl);
160 ev_std_exec_on_task_fini(
ev_exec_t *exec_)
162 struct ev_std_exec *exec = ev_std_exec_from_exec(exec_);
164 assert((*exec->impl)->on_task_fini);
166 (*exec->impl)->on_task_fini(exec->impl);
173 assert(!task->
exec || task->
exec == exec);
177 ev_std_exec_post(exec, task);
193 struct ev_std_exec *exec = ev_std_exec_from_exec(exec_);
195 assert((*exec->impl)->post);
197 assert(!task->
exec || task->
exec == exec_);
202 (*exec->impl)->post(exec->impl, task);
210 assert(!task->
exec || task->
exec == exec);
214 ev_std_exec_post(exec, task);
221 ev_std_exec_on_task_init(exec);
222 assert((*pnode)->queue);
223 assert((*pnode)->queue->queue);
230 struct ev_std_exec *exec = ev_std_exec_from_exec(exec_);
232 assert((*exec->impl)->abort);
239 assert((*pnode)->queue);
240 struct sllist *queue = (*pnode)->queue->queue;
244 ev_std_exec_on_task_fini(exec_);
245 nnode += nnode < SIZE_MAX;
248 ev_std_exec_on_task_fini(exec_);
254 nimpl = (*exec->impl)->abort(exec->impl, task);
256 return nimpl < SIZE_MAX - nnode ? nnode + nimpl : SIZE_MAX;
262 struct ev_std_exec *exec = ev_std_exec_from_exec(exec_);
264 assert((*exec->impl)->post);
266 assert(!task->
exec || task->
exec == exec_);
277 struct ev_exec_node exec_node = { NULL, exec_, &queue_node };
281 queue_node.next = (*pnode)->queue;
282 (*pnode)->queue = &queue_node;
284 exec_node.next = *plist;
290 pnode = ev_exec_find(exec_, plist);
292 assert((*pnode)->queue == &queue_node);
293 if ((*pnode)->queue->next) {
294 (*pnode)->queue = (*pnode)->queue->next;
300 assert(task->
exec == exec_);
301 (*exec->impl)->post(exec->impl, task);
302 ev_std_exec_on_task_fini(exec_);
308 ev_std_exec_from_exec(
const ev_exec_t *exec)
318 while (*
pnode && (*pnode)->exec != exec)
This header file is part of the utilities library; it contains the native and platform-independent er...
int get_errc(void)
Returns the last (thread-specific) native error code set by a system call or library function.
void set_errc(int errc)
Sets the current (thread-specific) native error code to errc.
int errno2c(int errnum)
Transforms a standard C error number to a native error code.
This header file is part of the event library; it contains the abstract task executor interface.
#define _Thread_local
An object whose identifier is declared with the storage-class specifier _Thread_local has thread stor...
const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
This is the public header file of the utilities library.
#define structof(ptr, type, member)
Obtains the address of a structure from the address of one of its members.
void sllist_init(struct sllist *list)
Initializes a singly-linked list.
struct slnode * sllist_remove(struct sllist *list, struct slnode *node)
Removes a node from a singly-linked list.
void sllist_push_back(struct sllist *list, struct slnode *node)
Pushes a node to the back of a singly-linked list.
struct slnode * sllist_pop_front(struct sllist *list)
Pops a node from the front of a singly-linked list.
This is the internal header file of the event library.
This header file is part of the event library; it contains the standard executor declarations.
This header file is part of the C11 and POSIX compatibility library; it includes <stdint....
This header file is part of the C11 and POSIX compatibility library; it includes <stdlib....
ev_task_func_t * func
The function to be invoked when the task is run.
ev_exec_t * exec
A pointer to the executor to which the task is (to be) submitted.
A node in a pairing heap.
struct pnode * next
A pointer to the next sibling node.
This header file is part of the event library; it contains the task declarations.
struct ev_task * ev_task_from_node(struct slnode *node)
Converts a pointer to a node in a queue to the address of the task containing the node.