[coop] Refactor/reuse mono_value_box_handle/mono_value_box_checked and reduce raw...
[mono-project.git] / mono / utils / mono-poll.h
blobe44f923fbafe5d53881cd4f67d5ba73e37411daa
1 /**
2 * \file
3 */
5 #ifndef MONO_POLL_H
6 #define MONO_POLL_H
8 #include <mono/utils/mono-publib.h>
10 #include <config.h>
11 #ifdef HAVE_SYS_TIME_H
12 #include <sys/time.h>
13 #endif
14 #include <sys/types.h>
15 #ifdef HAVE_UNISTD_H
16 #include <unistd.h>
17 #endif
19 #ifdef HAVE_POLL
20 #ifdef HAVE_POLL_H
21 #include <poll.h>
22 #elif defined(HAVE_SYS_POLL_H)
23 #include <sys/poll.h>
24 #endif
26 #define MONO_POLLIN POLLIN
27 #define MONO_POLLPRI POLLPRI
28 #define MONO_POLLOUT POLLOUT
29 #define MONO_POLLERR POLLERR
30 #define MONO_POLLHUP POLLHUP
31 #define MONO_POLLNVAL POLLNVAL
33 typedef struct pollfd mono_pollfd;
35 #else
37 #ifdef HOST_WIN32
38 #include <windows.h>
39 #endif
40 #define MONO_POLLIN 1
41 #define MONO_POLLPRI 2
42 #define MONO_POLLOUT 4
43 #define MONO_POLLERR 8
44 #define MONO_POLLHUP 0x10
45 #define MONO_POLLNVAL 0x20
47 typedef struct {
48 int fd;
49 short events;
50 short revents;
51 } mono_pollfd;
53 #endif
55 MONO_API int mono_poll (mono_pollfd *ufds, unsigned int nfds, int timeout);
57 #endif /* MONO_POLL_H */