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 
32 typedef const struct ev_poll_vtbl *const ev_poll_t;
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 struct ev_poll_vtbl {
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 
48 LELY_EV_POLL_INLINE void *ev_poll_self(const ev_poll_t *poll);
49 
58 LELY_EV_POLL_INLINE int ev_poll_wait(ev_poll_t *poll, int timeout);
59 
66 LELY_EV_POLL_INLINE int ev_poll_kill(ev_poll_t *poll, void *thr);
67 
68 inline void *
69 ev_poll_self(const ev_poll_t *poll)
70 {
71  return (*poll)->self(poll);
72 }
73 
74 inline int
75 ev_poll_wait(ev_poll_t *poll, int timeout)
76 {
77  return (*poll)->wait(poll, timeout);
78 }
79 
80 inline int
81 ev_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_
ev_poll_vtbl
Definition: poll.h:38
ev_poll_t
const struct ev_poll_vtbl *const ev_poll_t
The abstract polling interface.
Definition: poll.h:32
ev_poll_kill
int ev_poll_kill(ev_poll_t *poll, void *thr)
Interrupts a polling wait on the specified thread.
Definition: poll.h:81
ev.h
ev_poll_wait
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
ev_poll_self
void * ev_poll_self(const ev_poll_t *poll)
Returns the identifier of the calling thread.
Definition: poll.h:69