-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent_base_loopbreak.3
127 lines (127 loc) · 3.31 KB
/
event_base_loopbreak.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
.\" $OpenBSD$
.\" Copyright (c) 2023 Ted Bullock <tbullock@comlore.com>
.\"
.\" 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$
.Dt EVENT_BASE_LOOPBREAK 3
.Os
.Sh NAME
.Nm event_base_loopbreak ,
.Nm event_base_loopexit ,
.Nm event_loopbreak ,
.Nm event_loopexit
.Nd schedule termination of an event loop
.Sh SYNOPSIS
.In event.h
.Ft int
.Fn event_base_loopbreak "struct event_base *base"
.Ft int
.Fn event_base_loopexit "struct event_base *base" "const struct timeval *tv"
.Ft int
.Fn event_loopbreak void
.Ft int
.Fn event_loopexit "const struct timeval *tv"
.Sh DESCRIPTION
These functions terminate an event loop early even if it would normally
continue waiting for scheduled events.
.Pp
.Fn event_base_loopbreak
is intended to be called from within a user-defined event callback where it
instructs the event loop to terminate after the callback completes.
The argument
.Va base
is a pointer to an
.Vt event_base
structure initialized by
.Xr event_base_new 3 .
If
.Va base
is
.Dv NULL
the function fails.
.Pp
.Fn event_base_loopexit
schedules a timeout event that is triggered when
.Fa tv
time has passed and then exits the event loop after all activated events with
the default queue number have been processed.
For further information on queue numbers see
.Xr event_base_priority_init 3 .
The function fails if it is unable to configure the timeout event.
.Pp
The argument
.Fa base
is a pointer to an
.Vt event_base
structure configured by
.Xr event_base_new 3 .
The behavior is undefined if
.Va base
is
.Dv NULL .
.Fa tv
is a pointer to a populated
.Vt timeval
structure representing the amount of time until the timeout expires.
If
.Va tv
is
.Dv NULL
or negative, the timeout expires immediately upon starting the event loop.
.Pp
.Fn event_loopbreak
and
.Fn event_loopexit
have similar behavior to
.Fn event_base_loopbreak
and
.Fn event_base_loopexit
respectively, and require that the library be initialized with
.Xr event_init 3 .
.Sh RETURN VALUES
These functions return 0 on success or \-1 on failure.
.Sh SEE ALSO
.Xr event_base_loop 3 ,
.Xr event_base_new 3 ,
.Xr event_base_priority_init 3
.Sh HISTORY
.Fn event_loopexit
first appeared in libevent-0.8 and has been available since
.Ox 3.6 .
.Pp
.Fn event_base_loopexit
first appeared in libevent-1.0c and has been available since
.Ox 3.8 .
.Pp
.Fn event_loopbreak
and
.Fn event_base_loopbreak
first appeared in libevent-1.4.1 and have been available since
.Ox 4.8 .
.Sh AUTHORS
.Fn event_loopexit
and
.Fn event_base_loopexit
were written by
.An Niels Provos
and
.Fn event_loopbreak
and
.Fn event_base_loopbreak
by
.An -nosplit
.An Scott Lamb .
.Pp
This manual page was written by
.An Ted Bullock Aq Mt tbullock@comlore.com .