Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

.TH "event" 3 "Tue Jan 31 2017" "libevent" \" -*- nroff -*-
.ad l
.nh
.SH NAME
event \- Structure to represent a single event\&.  

.SH SYNOPSIS
.br
.PP
.PP
\fC#include <event\&.h>\fP
.SH "Detailed Description"
.PP 
Structure to represent a single event\&. 

An event can have some underlying condition it represents: a socket becoming readable or writeable (or both), or a signal becoming raised\&. (An event that represents no underlying condition is still useful: you can use one to implement a timer, or to communicate between threads\&.)
.PP
Generally, you can create events with \fBevent_new()\fP, then make them pending with \fBevent_add()\fP\&. As your \fBevent_base\fP runs, it will run the callbacks of an events whose conditions are triggered\&. When you longer want the event, free it with \fBevent_free()\fP\&.
.PP
In more depth:
.PP
An event may be 'pending' (one whose condition we are watching), 'active' (one whose condition has triggered and whose callback is about to run), neither, or both\&. Events come into existence via \fBevent_assign()\fP or \fBevent_new()\fP, and are then neither active nor pending\&.
.PP
To make an event pending, pass it to \fBevent_add()\fP\&. When doing so, you can also set a timeout for the event\&.
.PP
Events become active during an \fBevent_base_loop()\fP call when either their condition has triggered, or when their timeout has elapsed\&. You can also activate an event manually using \fBevent_active()\fP\&. The even_base loop will run the callbacks of active events; after it has done so, it marks them as no longer active\&.
.PP
You can make an event non-pending by passing it to \fBevent_del()\fP\&. This also makes the event non-active\&.
.PP
Events can be 'persistent' or 'non-persistent'\&. A non-persistent event becomes non-pending as soon as it is triggered: thus, it only runs at most once per call to \fBevent_add()\fP\&. A persistent event remains pending even when it becomes active: you'll need to \fBevent_del()\fP it manually in order to make it non-pending\&. When a persistent event with a timeout becomes active, its timeout is reset: this means you can use persistent events to implement periodic timeouts\&.
.PP
This should be treated as an opaque structure; you should never read or write any of its fields directly\&. For backward compatibility with old code, it is defined in the event2/event_struct\&.h header; including this header may make your code incompatible with other versions of Libevent\&.
.PP
\fBSee also:\fP
.RS 4
\fBevent_new()\fP, \fBevent_free()\fP, \fBevent_assign()\fP, \fBevent_get_assignment()\fP, \fBevent_add()\fP, \fBevent_del()\fP, \fBevent_active()\fP, \fBevent_pending()\fP, \fBevent_get_fd()\fP, \fBevent_get_base()\fP, \fBevent_get_events()\fP, \fBevent_get_callback()\fP, \fBevent_get_callback_arg()\fP, \fBevent_priority_set()\fP 
.RE
.PP


.SH "Author"
.PP 
Generated automatically by Doxygen for libevent from the source code\&.