summaryrefslogtreecommitdiffstats
path: root/lib/waiter/waiter.h
blob: 9a8acf446f0196bd00ecde681cebc1def5b87e58 (plain)
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
#ifndef _WAITER_H
#define _WAITER_H

#include <poll.h>

struct waiter;
struct waitset;

enum events {
	WAIT_IN  = POLLIN,
	WAIT_OUT = POLLOUT,
};

typedef int (*waiter_cb)(void *);

struct waitset *waitset_create(void *ctx);

struct waiter *waiter_register_io(struct waitset *waitset, int fd, int events,
		waiter_cb callback, void *arg);

struct waiter *waiter_register_timeout(struct waitset *set, int delay_ms,
		waiter_cb callback, void *arg);

void waiter_remove(struct waiter *waiter);

int waiter_poll(struct waitset *waitset);
#endif /* _WAITER_H */


OpenPOWER on IntegriCloud