aboutsummaryrefslogtreecommitdiffstats
path: root/iolooper.h
blob: 2822f7187c84d7c5943fc059ba0310aaafb86e6a (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
#ifndef IOLOOPER_H
#define IOLOOPER_H

#include <stdint.h>

/* An IOLooper is an abstraction for select() */

typedef struct IoLooper  IoLooper;

IoLooper*  iolooper_new(void);
void       iolooper_free( IoLooper*  iol );
void       iolooper_reset( IoLooper*  iol );

void       iolooper_add_read( IoLooper*  iol, int  fd );
void       iolooper_add_write( IoLooper*  iol, int  fd );
void       iolooper_del_read( IoLooper*  iol, int  fd );
void       iolooper_del_write( IoLooper*  iol, int  fd );

int        iolooper_poll( IoLooper*  iol );
int        iolooper_wait( IoLooper*  iol, int64_t  duration );

int        iolooper_is_read( IoLooper*  iol, int  fd );
int        iolooper_is_write( IoLooper*  iol, int  fd );
/* Returns 1 if this IoLooper has one or more file descriptor to interact with */
int        iolooper_has_operations( IoLooper*  iol );

#endif /* IOLOOPER_H */