Lely core libraries 2.3.4
poll.h
Go to the documentation of this file.
1
22#ifndef LELY_EV_POLL_H_
23#define LELY_EV_POLL_H_
24
25#include <lely/ev/ev.h>
26
27#ifndef LELY_EV_POLL_INLINE
28#define LELY_EV_POLL_INLINE static inline
29#endif
30
32typedef const struct ev_poll_vtbl *const ev_poll_t;
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
39 void *(*self)(const ev_poll_t *poll);
40 int (*wait)(ev_poll_t *poll, int timeout);
41 int (*kill)(ev_poll_t *poll, void *thr);
42};
43
48LELY_EV_POLL_INLINE void *ev_poll_self(const ev_poll_t *poll);
49
58LELY_EV_POLL_INLINE int ev_poll_wait(ev_poll_t *poll, int timeout);
59
66LELY_EV_POLL_INLINE int ev_poll_kill(ev_poll_t *poll, void *thr);
67
68inline void *
70{
71 return (*poll)->self(poll);
72}
73
74inline int
75ev_poll_wait(ev_poll_t *poll, int timeout)
76{
77 return (*poll)->wait(poll, timeout);
78}
79
80inline int
81ev_poll_kill(ev_poll_t *poll, void *thr)
82{
83 return (*poll)->kill(poll, thr);
84}
85
86#ifdef __cplusplus
87}
88#endif
89
90#endif // !LELY_EV_POLL_H_
void * ev_poll_self(const ev_poll_t *poll)
Returns the identifier of the calling thread.
Definition: poll.h:69
const struct ev_poll_vtbl *const ev_poll_t
The abstract polling interface.
Definition: poll.h:32
int ev_poll_kill(ev_poll_t *poll, void *thr)
Interrupts a polling wait on the specified thread.
Definition: poll.h:81
int ev_poll_wait(ev_poll_t *poll, int timeout)
Waits for at most timeout milliseconds while polling for new events.
Definition: poll.h:75
This is the public header file of the event library.