-
Notifications
You must be signed in to change notification settings - Fork 4
/
structevent.html
98 lines (94 loc) · 9.1 KB
/
structevent.html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libevent: event Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">libevent
 <span id="projectnumber">2.2.1</span>
</div>
<div id="projectbrief">Event notification library</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">event Struct Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Structure to represent a single event.
<a href="structevent.html#details">More...</a></p>
<p><code>#include <<a class="el" href="event_8h_source.html">event.h</a>></code></p>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Structure to represent a single event. </p>
<p>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.)</p>
<p>Generally, you can create events with <a class="el" href="event_8h.html#a6cd300e5cd15601c5e4570b221b20397" title="Allocate and assign a new event structure, ready to be added.">event_new()</a>, then make them pending with <a class="el" href="event_8h.html#ab0c85ebe9cf057be1aa17724c701b0c8" title="Add an event to the set of pending events.">event_add()</a>. As your <a class="el" href="structevent__base.html" title="Structure to hold information and state for a Libevent dispatch loop.">event_base</a> runs, it will run the callbacks of an events whose conditions are triggered. When you no longer want the event, free it with <a class="el" href="event_8h.html#a1f326019b65d319b2221b7e57d56c273" title="Deallocate a struct event * returned by event_new().">event_free()</a>.</p>
<p>In more depth:</p>
<p>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 <a class="el" href="event_8h.html#a3e49a8172e00ae82959dfe64684eda11" title="Prepare a new, already-allocated event structure to be added.">event_assign()</a> or <a class="el" href="event_8h.html#a6cd300e5cd15601c5e4570b221b20397" title="Allocate and assign a new event structure, ready to be added.">event_new()</a>, and are then neither active nor pending.</p>
<p>To make an event pending, pass it to <a class="el" href="event_8h.html#ab0c85ebe9cf057be1aa17724c701b0c8" title="Add an event to the set of pending events.">event_add()</a>. When doing so, you can also set a timeout for the event.</p>
<p>Events become active during an <a class="el" href="event_8h.html#acd7da32086d1e37008e7c76c9ea54fc4" title="Wait for events to become active, and run their callbacks.">event_base_loop()</a> call when either their condition has triggered, or when their timeout has elapsed. You can also activate an event manually using <a class="el" href="event_8h.html#a31d9440cf2b7010e32a05a2142a91525" title="Make an event active.">event_active()</a>. The even_base loop will run the callbacks of active events; after it has done so, it marks them as no longer active.</p>
<p>You can make an event non-pending by passing it to <a class="el" href="event_8h.html#a2ffc10a652c67bea16b0a71f7d5a44dc" title="Remove an event from the set of monitored events.">event_del()</a>. This also makes the event non-active.</p>
<p>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 <a class="el" href="event_8h.html#ab0c85ebe9cf057be1aa17724c701b0c8" title="Add an event to the set of pending events.">event_add()</a>. A persistent event remains pending even when it becomes active: you'll need to <a class="el" href="event_8h.html#a2ffc10a652c67bea16b0a71f7d5a44dc" title="Remove an event from the set of monitored events.">event_del()</a> 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.</p>
<p>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.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="event_8h.html#a6cd300e5cd15601c5e4570b221b20397" title="Allocate and assign a new event structure, ready to be added.">event_new()</a>, <a class="el" href="event_8h.html#a1f326019b65d319b2221b7e57d56c273" title="Deallocate a struct event * returned by event_new().">event_free()</a>, <a class="el" href="event_8h.html#a3e49a8172e00ae82959dfe64684eda11" title="Prepare a new, already-allocated event structure to be added.">event_assign()</a>, <a class="el" href="event_8h.html#a6ddcda6db7bd3fc1e0f635d60e145a03" title="Extract all of arguments given to construct a given event.">event_get_assignment()</a>, <a class="el" href="event_8h.html#ab0c85ebe9cf057be1aa17724c701b0c8" title="Add an event to the set of pending events.">event_add()</a>, <a class="el" href="event_8h.html#a2ffc10a652c67bea16b0a71f7d5a44dc" title="Remove an event from the set of monitored events.">event_del()</a>, <a class="el" href="event_8h.html#a31d9440cf2b7010e32a05a2142a91525" title="Make an event active.">event_active()</a>, <a class="el" href="event_8h.html#a9b1687396305898af018c74e63486eb5" title="Checks if a specific event is pending or scheduled.">event_pending()</a>, <a class="el" href="event_8h.html#a4f63589ebe3e0d4c9e20447f96d343b2" title="Get the socket or signal assigned to an event, or -1 if the event has no socket.">event_get_fd()</a>, <a class="el" href="event_8h.html#ab90af034dd2638511f483bd25effdc77" title="Get the event_base associated with an event.">event_get_base()</a>, <a class="el" href="event_8h.html#a70989121937ecb71358a2d76be772d51" title="Return the events (EV_READ, EV_WRITE, etc) assigned to an event.">event_get_events()</a>, <a class="el" href="event_8h.html#a6e325a315660638135385dc3b608bf85" title="Return the callback assigned to an event.">event_get_callback()</a>, <a class="el" href="event_8h.html#ad868b16c4dc7450e49ba277b9ee7b467" title="Return the callback argument assigned to an event.">event_get_callback_arg()</a>, <a class="el" href="event_8h.html#a11a800dce1fe61de5e2506aaf603c47f" title="Assign a priority to an event.">event_priority_set()</a> </dd></dl>
</div><hr/>The documentation for this struct was generated from the following file:<ul>
<li>event2/<a class="el" href="event_8h_source.html">event.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>