OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions | Data Fields
event Struct Reference

Structure to represent a single event. More...

`#include <event.h>`

## Public Member Functions
| TAILQ_ENTRY (event) ev_active_next
| TAILQ_ENTRY (event) ev_next

## Data Fields
union {
int min_heap_idx
} | ev_timeout_pos
evutil_socket_t | ev_fd
struct event_base * | ev_base
union {
struct {
struct timeval ev_timeout
} ev_io
struct {
short ev_ncalls
short * ev_pncalls
} ev_signal
} | _ev
short | ev_events
short | ev_res
short | ev_flags
ev_uint8_t | ev_pri
ev_uint8_t | ev_closure
void(* | ev_callback )(evutil_socket_t, short, void *arg)
void * | ev_arg

## 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 event_new(), then make them pending with event_add(). As your event_base runs, it will run the callbacks of an events whose conditions are triggered. When you longer want the event, free it with event_free().

In more depth:

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 event_assign() or event_new(), and are then neither active nor pending.

To make an event pending, pass it to event_add(). When doing so, you can also set a timeout for the event.

Events become active during an event_base_loop() call when either their condition has triggered, or when their timeout has elapsed. You can also activate an event manually using 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 event_del(). This also makes the event non-active.

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 event_add(). A persistent event remains pending even when it becomes active: you'll need to 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 event2/event_struct.h header; including this header may make your code incompatible with other versions of Libevent.

See also
  event_new(), event_free(), event_assign(), event_get_assignment(), event_add(), event_del(), event_active(), event_pending(), event_get_fd(), event_get_base(), event_get_events(), event_get_callback(), event_get_callback_arg(), event_priority_set()

The documentation for this struct was generated from the following file:

- opal/mca/event/libevent2013/libevent/include/event2/event_struct.h