-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevl_init.3
78 lines (78 loc) · 2.34 KB
/
evl_init.3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
.\" $OpenBSD$
.\"
.\" Copyright (c) 2017 David Gwynne <[email protected]>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 6 2017 $
.Dt EVL_INIT 3
.Os
.Sh NAME
.Nm evl_init ,
.Nm evl_dispatch
.Nd event loop library
.Sh SYNOPSIS
.In evl.h
.Ft struct evl_base *
.Fn evl_init "void"
.Ft int
.Fn evl_dispatch "struct evl_base *elvb"
.Ft void
.Fn evl_break "struct evl_base *evlb"
.Sh DESCRIPTION
The Event Loop API provides a mechanism to execute a function in
response to an event occuring.
The API currently supports events generated by file descriptors or
from timeouts expiring.
.Pp
An event loop is created by calling
.Fn evl_init .
.Pp
Execution of events starts when the application calls
.Fn evl_dispatch .
Events may be created and added to the event loop
.Fa elvb
before the call to
.Fn evl_dispatch ,
or from callbacks dispatched by the event loop.
.Pp
.Fn evl_break
may be called in a callback running inside
.Fn evl_dispatch
to stop processing further events and make it return to the application.
.Pp
For information on creating and using file descriptor events, refer to
.Xr evl_io_create 3 .
For information on creating and using timeout events, refer to
.Xr evl_tmo_create 3 .
.Sh RETURN VALUES
.Fn evl_init
returns a pointer to a newly created and initialised event loop
base on success, or
.Dv NULL
on failure and sets
.Va errno
to indicate the failure.
.Pp
.Fn evl_dispatch
returns 0 if there were no more events to process, or as the result
of a call to
.Fn evl_break .
.Fn evl_dispatch
will return -1 if there was an error during event processing and sets
.Va errno
to indicate the failure.
.Sh SEE ALSO
.Xr errno 2 ,
.Xr evl_io_create 3 ,
.Xr evl_tmo_create 3