-
Notifications
You must be signed in to change notification settings - Fork 9
/
eventpriv.h
53 lines (47 loc) · 1.75 KB
/
eventpriv.h
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
/***********************************************************************
*
* eventpriv.h
*
* Abstraction of select call into "event-handling" to make programming
* easier. This header includes "private" definitions which users
* of the event-handling code should not care about.
*
* Copyright (C) 2001-2003 Roaring Penguin Software Inc.
*
* This program may be distributed according to the terms of the GNU
* General Public License, version 2 or (at your option) any later version.
*
***********************************************************************/
#ifndef INCLUDE_EVENTPRIV_H
#define INCLUDE_EVENTPRIV_H 1
#include "config.h"
#include <sys/time.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef EVENT_USE_POLL
#include <poll.h>
#endif
/* Handler structure */
typedef struct EventHandler_t {
struct EventHandler_t *next; /* Link in list */
int fd; /* File descriptor for select */
unsigned int flags; /* Select on read or write; enable timeout */
#ifdef EVENT_USE_POLL
unsigned int pollflags; /* Flags returned by poll() */
#endif
struct timeval tmout; /* Absolute time for timeout */
EventCallbackFunc fn; /* Callback function */
void *data; /* Extra data to pass to callback */
} EventHandler;
/* Selector structure */
typedef struct EventSelector_t {
EventHandler *handlers; /* Linked list of EventHandlers */
int nestLevel; /* Event-handling nesting level */
int opsPending; /* True if operations are pending */
int destroyPending; /* If true, a destroy is pending */
} EventSelector;
/* Private flags */
#define EVENT_FLAG_DELETED 256
#endif