summaryrefslogtreecommitdiffstats
path: root/lib/waiter/waiter.h
blob: 58ea04c628ac6cd346493a4a8cfb0f24860eec7c (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
30
#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);
void waitset_destroy(struct waitset *waitset);

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