iolooper.h revision cc19d3eeef59cbd354c1c618f7421d6fe5e0a098
1#ifndef IOLOOPER_H
2#define IOLOOPER_H
3
4#include <stdint.h>
5
6/* An IOLooper is an abstraction for select() */
7
8typedef struct IoLooper  IoLooper;
9
10IoLooper*  iolooper_new(void);
11void       iolooper_free( IoLooper*  iol );
12void       iolooper_reset( IoLooper*  iol );
13
14void       iolooper_add_read( IoLooper*  iol, int  fd );
15void       iolooper_add_write( IoLooper*  iol, int  fd );
16void       iolooper_del_read( IoLooper*  iol, int  fd );
17void       iolooper_del_write( IoLooper*  iol, int  fd );
18
19int        iolooper_poll( IoLooper*  iol );
20int        iolooper_wait( IoLooper*  iol, int64_t  duration );
21
22int        iolooper_is_read( IoLooper*  iol, int  fd );
23int        iolooper_is_write( IoLooper*  iol, int  fd );
24/* Returns 1 if this IoLooper has one or more file descriptor to interact with */
25int        iolooper_has_operations( IoLooper*  iol );
26
27#endif /* IOLOOPER_H */
28