OpenMPI 0.1.1

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

- File List
- Globals

evmap-internal.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2007-2010 Niels Provos and Nick Mathewson
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26 #ifndef _EVMAP_H_
27 #define _EVMAP_H_
28
29 /** @file evmap-internal.h
30 *
31 * An event_map is a utility structure to map each fd or signal to zero or
32 * more events. Functions to manipulate event_maps should only be used from
33 * inside libevent. They generally need to hold the lock on the corresponding
34 * event_base.
35 **/
36
37 struct event_base;
38 struct event;
39
40 /** Initialize an event_map for use.
41 */
42 void evmap_io_initmap(struct event_io_map* ctx);
43 void evmap_signal_initmap(struct event_signal_map* ctx);
44
45 /** Remove all entries from an event_map.
46
47 @param ctx the map to clear.
48 */
49 void evmap_io_clear(struct event_io_map* ctx);
50 void evmap_signal_clear(struct event_signal_map* ctx);
51
52 /** Add an IO event (some combination of EV_READ or EV_WRITE) to an
53 event_base's list of events on a given file descriptor, and tell the
54 underlying eventops about the fd if its state has changed.
55
56 Requires that ev is not already added.
57
58 @param base the event_base to operate on.
59 @param fd the file descriptor corresponding to ev.
60 @param ev the event to add.
61 */
62 int evmap_io_add(struct event_base *base, evutil_socket_t fd, struct event *ev);
63 /** Remove an IO event (some combination of EV_READ or EV_WRITE) to an
64 event_base's list of events on a given file descriptor, and tell the
65 underlying eventops about the fd if its state has changed.
66
67 @param base the event_base to operate on.
68 @param fd the file descriptor corresponding to ev.
69 @param ev the event to remove.
70 */
71 int evmap_io_del(struct event_base *base, evutil_socket_t fd, struct event *ev);
72 /** Active the set of events waiting on an event_base for a given fd.
73
74 @param base the event_base to operate on.
75 @param fd the file descriptor that has become active.
76 @param events a bitmask of EV_READ|EV_WRITE|EV_ET.
77 */
78 void evmap_io_active(struct event_base *base, evutil_socket_t fd, short events);
79
80
81 /* These functions behave in the same way as evmap_io_*, except they work on
82 * signals rather than fds. signals use a linear map everywhere; fds use
83 * either a linear map or a hashtable. */
84 int evmap_signal_add(struct event_base *base, int signum, struct event *ev);
85 int evmap_signal_del(struct event_base *base, int signum, struct event *ev);
86 void evmap_signal_active(struct event_base *base, evutil_socket_t signum, int ncalls);
87
88 void *evmap_io_get_fdinfo(struct event_io_map *ctx, evutil_socket_t fd);
89
90 #endif /* _EVMAP_H_ */
evmap_io_clear
void evmap_io_clear(struct event_io_map *ctx)
Remove all entries from an event_map.
Definition: evmap.c:191
evmap_io_active
void evmap_io_active(struct event_base *base, evutil_socket_t fd, short events)
Active the set of events waiting on an event_base for a given fd.
Definition: evmap.c:390
event
Structure to represent a single event.
Definition: event_struct.h:87
evmap_io_del
int evmap_io_del(struct event_base *base, evutil_socket_t fd, struct event *ev)
Remove an IO event (some combination of EV_READ or EV_WRITE) to an event_base's list of events on a g...
Definition: evmap.c:336
event_signal_map
Definition: event-internal.h:124
evutil_socket_t
#define evutil_socket_t
A type wide enough to hold the output of "socket()" or "accept()".
Definition: util.h:278
evmap_io_initmap
void evmap_io_initmap(struct event_io_map *ctx)
Initialize an event_map for use.
Definition: evmap.c:186
event_base
Definition: event-internal.h:167
evmap_io_add
int evmap_io_add(struct event_base *base, evutil_socket_t fd, struct event *ev)
Add an IO event (some combination of EV_READ or EV_WRITE) to an event_base's list of events on a give...
Definition: evmap.c:263