1
.\" This man page is Copyright (C) 2003, 2010 Lennert Buytenhek.
2
.\" Permission is granted to distribute possibly modified copies
3
.\" of this page provided the header is included verbatim,
4
.\" and in case of nontrivial modification author and date
5
.\" of the modification is added to the header.
6
.TH iv_task 3 2010-08-15 "ivykis" "ivykis programmer's manual"
8
iv_task_register, iv_task_unregister, iv_task_registered \- deal with ivykis tasks
15
void (*handler)(void *);
19
.BI "void IV_TASK_INIT(struct iv_task *" task ");"
21
.BI "void iv_task_register(struct iv_task *" task ");"
23
.BI "void iv_task_unregister(struct iv_task *" task ");"
25
.BI "int iv_task_registered(struct iv_task *" task ");"
32
register, respectively unregister, a task with the current thread's
35
on a task returns true if that task is currently registered with ivykis.
37
A task is like a timer, but with an immediate timeout. When a task
38
is registered, unless it is unregistered again first, the callback
41
is guaranteed to be called once, in the thread that the task was
42
registered in, some time after control returns to the ivykis main
43
loop but before ivykis will sleep for more events, with
45
as its first and sole argument. When this happens, the task is
46
transparently unregistered.
48
Tasks are mainly used for scheduling code for execution where it is not
49
appropriate to directly run that code in the calling context (for
50
example, because the current context might be run as a callback function
51
where the caller expects certain conditions to remain invariant after
52
the callback completes).
54
The application is allowed to change the
62
can only be registered in one thread at a time, and a task can only
63
be unregistered in the thread that it was registered from.
65
There is no limit on the number of tasks registered at once.
69
for programming examples.