]> git.ipfire.org Git - thirdparty/bird.git/blame - lib/event.h
Added documentation for 'disable after cease'
[thirdparty/bird.git] / lib / event.h
CommitLineData
3b15402f
MM
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
14typedef struct event {
15 resource r;
8f6accb5 16 void (*hook)(void *);
3b15402f
MM
17 void *data;
18 node n; /* Internal link */
19} event;
20
21typedef list event_list;
22
23extern event_list global_event_list;
24
25event *ev_new(pool *);
8f6accb5 26void ev_run(event *);
3b15402f
MM
27#define ev_init_list(el) init_list(el)
28void ev_enqueue(event_list *, event *);
29void ev_schedule(event *);
30void ev_postpone(event *);
84a7d7f7 31int ev_run_list(event_list *);
3b15402f 32
6f8bbaa1
OZ
33static inline int
34ev_active(event *e)
35{
36 return e->n.next != NULL;
37}
38
c0fc3e67
OZ
39static inline event*
40ev_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
6f8bbaa1 48
3b15402f 49#endif