\hypertarget{structevent}{\section{event Struct Reference}
\label{structevent}\index{event@{event}}
}


Structure to represent a single event.  




{\ttfamily \#include $<$event.\+h$>$}

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{structevent_a252942f895982ebc978281e883044644}{{\bfseries T\+A\+I\+L\+Q\+\_\+\+E\+N\+T\+R\+Y} (\hyperlink{structevent}{event}) ev\+\_\+active\+\_\+next}\label{structevent_a252942f895982ebc978281e883044644}

\item 
\hypertarget{structevent_a7e00e07b37352122594f67e2204bb227}{{\bfseries T\+A\+I\+L\+Q\+\_\+\+E\+N\+T\+R\+Y} (\hyperlink{structevent}{event}) ev\+\_\+next}\label{structevent_a7e00e07b37352122594f67e2204bb227}

\end{DoxyCompactItemize}
\subsection*{Data Fields}
\begin{DoxyCompactItemize}
\item 
\hypertarget{structevent_a2ed7dd0b3d54c68e91230a1addeda577}{\begin{tabbing}
xx\=xx\=xx\=xx\=xx\=xx\=xx\=xx\=xx\=\kill
union \{\\
\>int {\bfseries min\_heap\_idx}\\
\} {\bfseries ev\_timeout\_pos}}\label{structevent_a2ed7dd0b3d54c68e91230a1addeda577}
\\

\end{tabbing}\item 
\hypertarget{structevent_a9bfd557498c7533817acf475d6b8b0d4}{\hyperlink{opal_2mca_2event_2libevent2013_2libevent_2include_2event2_2util_8h_a7ef0023565082a65020f6e56be59fd0b}{evutil\+\_\+socket\+\_\+t} {\bfseries ev\+\_\+fd}}\label{structevent_a9bfd557498c7533817acf475d6b8b0d4}

\item 
\hypertarget{structevent_ad0ca55c90047d869af935d02b6bf98d3}{struct \hyperlink{structevent__base}{event\+\_\+base} $\ast$ {\bfseries ev\+\_\+base}}\label{structevent_ad0ca55c90047d869af935d02b6bf98d3}

\item 
\hypertarget{structevent_afc3d6d34dc9f3684d8e881aa2825dbbf}{\begin{tabbing}
xx\=xx\=xx\=xx\=xx\=xx\=xx\=xx\=xx\=\kill
union \{\\
\>struct \{\\
\>\>struct timeval {\bfseries ev\_timeout}\\
\>\} {\bfseries ev\_io}\\
\>struct \{\\
\>\>short {\bfseries ev\_ncalls}\\
\>\>short $\ast$ {\bfseries ev\_pncalls}\\
\>\} {\bfseries ev\_signal}\\
\} {\bfseries \_ev}}\label{structevent_afc3d6d34dc9f3684d8e881aa2825dbbf}
\\

\end{tabbing}\item 
\hypertarget{structevent_a4837c3bb776378d92ce46720ecfd71be}{short {\bfseries ev\+\_\+events}}\label{structevent_a4837c3bb776378d92ce46720ecfd71be}

\item 
\hypertarget{structevent_ae32717459286aba1de4d19e5988414d0}{short {\bfseries ev\+\_\+res}}\label{structevent_ae32717459286aba1de4d19e5988414d0}

\item 
\hypertarget{structevent_a4d98339c7858d637187bfe54b06148af}{short {\bfseries ev\+\_\+flags}}\label{structevent_a4d98339c7858d637187bfe54b06148af}

\item 
\hypertarget{structevent_acb81e3dceb8da526bf82094d0b494f12}{ev\+\_\+uint8\+\_\+t {\bfseries ev\+\_\+pri}}\label{structevent_acb81e3dceb8da526bf82094d0b494f12}

\item 
\hypertarget{structevent_a8f8ebed8bc7bc766859e4a9177e4286d}{ev\+\_\+uint8\+\_\+t {\bfseries ev\+\_\+closure}}\label{structevent_a8f8ebed8bc7bc766859e4a9177e4286d}

\item 
\hypertarget{structevent_a23d42771d32228d7f700e8f015118384}{void($\ast$ {\bfseries ev\+\_\+callback} )(\hyperlink{opal_2mca_2event_2libevent2013_2libevent_2include_2event2_2util_8h_a7ef0023565082a65020f6e56be59fd0b}{evutil\+\_\+socket\+\_\+t}, short, void $\ast$arg)}\label{structevent_a23d42771d32228d7f700e8f015118384}

\item 
\hypertarget{structevent_a73daed0b06adc2661c2bb5cac36b6d72}{void $\ast$ {\bfseries ev\+\_\+arg}}\label{structevent_a73daed0b06adc2661c2bb5cac36b6d72}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
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.)

Generally, you can create events with \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_ab9a66f828d205eda84b321e32014cbbd}{event\+\_\+new()}, then make them pending with \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_a44df7b40859b56f2c866adb02dabdd9e}{event\+\_\+add()}. As your \hyperlink{structevent__base}{event\+\_\+base} runs, it will run the callbacks of an events whose conditions are triggered. When you longer want the event, free it with \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_ad7fd53b1263bf0fdccd959a6c5a659cc}{event\+\_\+free()}.

In more depth\+:

An event may be \char`\"{}pending\char`\"{} (one whose condition we are watching), \char`\"{}active\char`\"{} (one whose condition has triggered and whose callback is about to run), neither, or both. Events come into existence via \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_afade5e4859dee5b85d502e5594a05cf0}{event\+\_\+assign()} or \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_ab9a66f828d205eda84b321e32014cbbd}{event\+\_\+new()}, and are then neither active nor pending.

To make an event pending, pass it to \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_a44df7b40859b56f2c866adb02dabdd9e}{event\+\_\+add()}. When doing so, you can also set a timeout for the event.

Events become active during an \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_ad712706e6a763b6662f0eb03b3d8cd80}{event\+\_\+base\+\_\+loop()} call when either their condition has triggered, or when their timeout has elapsed. You can also activate an event manually using \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_a3262ae1dc7fe51516b43412d61301e4f}{event\+\_\+active()}. The even\+\_\+base loop will run the callbacks of active events; after it has done so, it marks them as no longer active.

You can make an event non-\/pending by passing it to \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_a30a8cb96af49d18388f64de73a2d4258}{event\+\_\+del()}. This also makes the event non-\/active.

Events can be \char`\"{}persistent\char`\"{} or \char`\"{}non-\/persistent\char`\"{}. A non-\/persistent event becomes non-\/pending as soon as it is triggered\+: thus, it only runs at most once per call to \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_a44df7b40859b56f2c866adb02dabdd9e}{event\+\_\+add()}. A persistent event remains pending even when it becomes active\+: you'll need to \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_a30a8cb96af49d18388f64de73a2d4258}{event\+\_\+del()} 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.

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 \hyperlink{event__struct_8h}{event2/event\+\_\+struct.\+h} header; including this header may make your code incompatible with other versions of Libevent.

\begin{DoxySeeAlso}{See also}
\hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_ab9a66f828d205eda84b321e32014cbbd}{event\+\_\+new()}, \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_ad7fd53b1263bf0fdccd959a6c5a659cc}{event\+\_\+free()}, \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_afade5e4859dee5b85d502e5594a05cf0}{event\+\_\+assign()}, \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_a2103c3cbf6e3e173419ebf019e29c788}{event\+\_\+get\+\_\+assignment()}, \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_a44df7b40859b56f2c866adb02dabdd9e}{event\+\_\+add()}, \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_a30a8cb96af49d18388f64de73a2d4258}{event\+\_\+del()}, \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_a3262ae1dc7fe51516b43412d61301e4f}{event\+\_\+active()}, \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_a49773a4e3e46f60e488ac37fb46950d9}{event\+\_\+pending()}, \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_aee0c9c3fc7c997e4d4b77bdcdf321ee6}{event\+\_\+get\+\_\+fd()}, \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_ae9763d285fa415e4547a0d5e55cf5b13}{event\+\_\+get\+\_\+base()}, \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_a0123fdd5b9a1c204de5d7ef1a4578387}{event\+\_\+get\+\_\+events()}, \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_a6cdb0a8dbf7efa9be7b65914ed5c6821}{event\+\_\+get\+\_\+callback()}, \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_ab07e87ff7d43ad7205a008f08fbaf0a3}{event\+\_\+get\+\_\+callback\+\_\+arg()}, \hyperlink{libevent2013_2libevent_2include_2event2_2event_8h_a9984a63f2edcc72bef96a188f569b367}{event\+\_\+priority\+\_\+set()} 
\end{DoxySeeAlso}


The documentation for this struct was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
opal/mca/event/libevent2013/libevent/include/event2/\hyperlink{event__struct_8h}{event\+\_\+struct.\+h}\end{DoxyCompactItemize}
