Lely core libraries
2.3.4
poll.hpp
Go to the documentation of this file.
1
24
#ifndef LELY_EV_POLL_HPP_
25
#define LELY_EV_POLL_HPP_
26
27
#include <
lely/ev/poll.h
>
28
#include <
lely/util/error.hpp
>
29
30
namespace
lely {
31
namespace
ev {
32
36
class
Poll
{
37
public
:
38
explicit
Poll
(
ev_poll_t
* poll) noexcept : poll_(poll) {}
39
40
operator
ev_poll_t
*()
const
noexcept {
return
poll_; }
41
43
void
*
44
self
()
const
noexcept {
45
return
ev_poll_self
(*
this
);
46
}
47
49
void
50
wait
(
int
timeout) {
51
if
(
ev_poll_wait
(*
this
, timeout) == -1) util::throw_errc(
"wait"
);
52
}
53
55
void
56
kill
(
void
* thr) {
57
if
(
ev_poll_kill
(*
this
, thr) == -1) util::throw_errc(
"kill"
);
58
}
59
60
protected
:
61
ev_poll_t
* poll_{
nullptr
};
62
};
63
64
}
// namespace ev
65
}
// namespace lely
66
67
#endif // !LELY_EV_POLL_HPP_
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
lely::ev::Poll::kill
void kill(void *thr)
Definition:
poll.hpp:56
lely::ev::Poll::wait
void wait(int timeout)
Definition:
poll.hpp:50
poll.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
lely::ev::Poll
The abstract polling interface.
Definition:
poll.hpp:36
ev_poll_self
void * ev_poll_self(const ev_poll_t *poll)
Returns the identifier of the calling thread.
Definition:
poll.h:69
error.hpp
include
lely
ev
poll.hpp
Generated by
1.8.17