Annotation of embedaddon/mpd/src/event.h, revision 1.1.1.2
1.1 misho 1: /*
2: * See ``COPYRIGHT.mpd''
3: *
1.1.1.2 ! misho 4: * $Id: event.h,v 1.1.1.1 2013/07/22 08:44:29 misho Exp $
1.1 misho 5: *
6: */
7:
8: #ifndef _EVENT_H_
9: #define _EVENT_H_
10:
11: /*
12: * DEFINITIONS
13: */
14:
15: /* Types of events */
16:
17: #define EVENT_READ PEVENT_READ /* value = file descriptor */
18: #define EVENT_WRITE PEVENT_WRITE /* value = file descriptor */
19: #define EVENT_TIMEOUT PEVENT_TIME /* value = time in miliseconds */
20:
21: #define EVENT_RECURRING PEVENT_RECURRING
22:
23: typedef void (*EventHdlr)(int type, void *cookie);
24:
25: struct event_ref
26: {
27: int type;
28: EventHdlr handler;
29: struct pevent *pe;
30: void *arg;
31: const char *dbg;
32: };
33: typedef struct event_ref EventRef;
34:
35: /*
36: * FUNCTIONS
37: */
38:
39: extern int EventInit(void);
40: extern void EventStop(void);
41: #define EventRegister(ref, type, value, flags, action, cookie) \
42: EventRegister2(ref, type, value, flags, action, cookie, \
43: #type " " #action "()",__FILE__, __LINE__)
44: extern int EventRegister2(EventRef *ref, int type, int value,
45: int flags, EventHdlr action, void *cookie, const char *dbg,
46: const char *file, int line);
47: #define EventUnRegister(ref) \
48: EventUnRegister2(ref, __FILE__, __LINE__)
49: extern int EventUnRegister2(EventRef *ref, const char *file, int line);
50: extern int EventIsRegistered(EventRef *ref);
51: extern int EventTimerRemain(EventRef *ref);
52: extern void EventDump(Context ctx, const char *msg);
53:
54: #endif
55:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>