Annotation of embedaddon/bird/lib/event.h, revision 1.1.1.2
1.1 misho 1: /*
2: * BIRD Library -- Event Processing
3: *
4: * (c) 1999 Martin Mares <mj@ucw.cz>
5: *
6: * Can be freely distributed and used under the terms of the GNU GPL.
7: */
8:
9: #ifndef _BIRD_EVENT_H_
10: #define _BIRD_EVENT_H_
11:
12: #include "lib/resource.h"
13:
14: typedef struct event {
15: resource r;
16: void (*hook)(void *);
17: void *data;
18: node n; /* Internal link */
19: } event;
20:
21: typedef list event_list;
22:
23: extern event_list global_event_list;
24:
25: event *ev_new(pool *);
26: void ev_run(event *);
27: #define ev_init_list(el) init_list(el)
28: void ev_enqueue(event_list *, event *);
29: void ev_schedule(event *);
30: void ev_postpone(event *);
31: int ev_run_list(event_list *);
32:
33: static inline int
34: ev_active(event *e)
35: {
36: return e->n.next != NULL;
37: }
38:
1.1.1.2 ! misho 39: static inline event*
! 40: ev_new_set(pool *p, void (*hook)(void *), void *data)
! 41: {
! 42: event *e = ev_new(p);
! 43: e->hook = hook;
! 44: e->data = data;
! 45: return e;
! 46: }
! 47:
1.1 misho 48:
49: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>