mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
describe signal_*
svn:r19
This commit is contained in:
parent
d10f85dbce
commit
06630e3116
43
event.3
43
event.3
@ -43,6 +43,11 @@
|
||||
.Nm timeout_del
|
||||
.Nm timeout_pending ,
|
||||
.Nm timeout_initalized ,
|
||||
.Nm signal_set ,
|
||||
.Nm signal_add ,
|
||||
.Nm signal_del
|
||||
.Nm signal_pending ,
|
||||
.Nm signal_initalized ,
|
||||
.Nd execute a function when a specific event occurs
|
||||
.Sh SYNOPSIS
|
||||
.Fd #include <event.h>
|
||||
@ -72,6 +77,16 @@
|
||||
.Fn "timeout_pending" "struct event *ev" "struct timeval *tv"
|
||||
.Ft int
|
||||
.Fn "timeout_initialized" "struct event *ev"
|
||||
.Ft void
|
||||
.Fn "signal_set" "struct event *ev" "int signal" "void (*fn)(int, short, void *)" "void *arg"
|
||||
.Ft void
|
||||
.Fn "signal_add" "struct event *ev" "struct timeval *"
|
||||
.Ft void
|
||||
.Fn "signal_del" "struct event *ev"
|
||||
.Ft int
|
||||
.Fn "signal_pending" "struct event *ev" "struct timeval *tv"
|
||||
.Ft int
|
||||
.Fn "signal_initialized" "struct event *ev"
|
||||
.Ft int
|
||||
.Fa (*event_sigcb)(void) ;
|
||||
.Ft int
|
||||
@ -165,13 +180,21 @@ The function
|
||||
will be called with the file descriptor that triggered the event and
|
||||
the type of event which will be either
|
||||
.Va EV_TIMEOUT ,
|
||||
.Va EV_SIGNAL ,
|
||||
.Va EV_READ ,
|
||||
or
|
||||
.Va EV_WRITE .
|
||||
The additional flag
|
||||
.Va EV_PERSIST
|
||||
makes an
|
||||
.Fn event_add
|
||||
persistent until
|
||||
.Fn event_del
|
||||
has been called.
|
||||
.Pp
|
||||
Once initialized, the
|
||||
.Fa ev
|
||||
structure can be used in repeatedly in
|
||||
structure can be used repeatedly with
|
||||
.Fn event_add
|
||||
and
|
||||
.Fn event_del
|
||||
@ -239,9 +262,25 @@ are abbreviations for common situations where only a timeout is required.
|
||||
The file descriptor passed will be 0, and the event type will be
|
||||
.Va EV_TIMEOUT .
|
||||
.Pp
|
||||
.Pp
|
||||
The functions
|
||||
.Fn signal_set ,
|
||||
.Fn signal_add ,
|
||||
.Fn signal_del ,
|
||||
.Fn signal_initialized ,
|
||||
and
|
||||
.Fn signal_pending
|
||||
are abbreviations.
|
||||
The event type will be a persistent
|
||||
.Va EV_SIGNAL .
|
||||
That means
|
||||
.Fn signal_set
|
||||
adds
|
||||
.Va EV_PERSIST .
|
||||
.Pp
|
||||
It is possible to disable support for
|
||||
.Va kqueue
|
||||
but setting the environment variable
|
||||
by setting the environment variable
|
||||
.Va EVENT_NOKQUEUE .
|
||||
.Pp
|
||||
.Sh RETURN VALUES
|
||||
|
Loading…
x
Reference in New Issue
Block a user