-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathiowatcher.h
More file actions
43 lines (39 loc) · 987 Bytes
/
Copy pathiowatcher.h
File metadata and controls
43 lines (39 loc) · 987 Bytes
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
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef IO_WATCHER_H_
#define IO_WATCHER_H_
#include "hloop.h"
#include "hplatform.h"
#if !defined(EVENT_SELECT) && \
!defined(EVENT_POLL) && \
!defined(EVENT_EPOLL) && \
!defined(EVENT_KQUEUE) && \
!defined(EVENT_PORT) && \
!defined(EVENT_IO_URING) && \
!defined(EVENT_NOEVENT)
#ifdef OS_WIN
#if WITH_WEPOLL
#define EVENT_EPOLL // wepoll -> iocp
#else
#define EVENT_POLL // WSAPoll
#endif
#elif defined(OS_LINUX)
#if WITH_IO_URING
#define EVENT_IO_URING
#else
#define EVENT_EPOLL
#endif
#elif defined(OS_MAC)
#define EVENT_KQUEUE
#elif defined(OS_BSD)
#define EVENT_KQUEUE
#elif defined(OS_SOLARIS)
#define EVENT_PORT
#else
#define EVENT_SELECT
#endif
#endif
int iowatcher_init(hloop_t* loop);
int iowatcher_cleanup(hloop_t* loop);
int iowatcher_add_event(hloop_t* loop, int fd, int events);
int iowatcher_del_event(hloop_t* loop, int fd, int events);
int iowatcher_poll_events(hloop_t* loop, int timeout);
#endif