Lely core libraries 2.3.4
timer.hpp
Go to the documentation of this file.
1
24#ifndef LEYL_IO2_SYS_TIMER_HPP_
25#define LEYL_IO2_SYS_TIMER_HPP_
26
27#include <lely/io2/sys/timer.h>
28#include <lely/io2/timer.hpp>
29
30#include <utility>
31
32namespace lely {
33namespace io {
34
36class Timer : public TimerBase {
37 public:
39 Timer(io_poll_t* poll, ev_exec_t* exec, clockid_t clockid)
40 : TimerBase(io_timer_create(poll, exec, clockid)) {
41 if (!timer) util::throw_errc("Timer");
42 }
43
44 Timer(const Timer&) = delete;
45
46 Timer(Timer&& other) noexcept : TimerBase(other.timer) {
47 other.timer = nullptr;
48 other.dev = nullptr;
49 }
50
51 Timer& operator=(const Timer&) = delete;
52
53 Timer&
54 operator=(Timer&& other) noexcept {
55 using ::std::swap;
56 swap(timer, other.timer);
57 swap(dev, other.dev);
58 return *this;
59 }
60
63};
64
65} // namespace io
66} // namespace lely
67
68#endif // !LEYL_IO2_SYS_TIMER_HPP_
A reference to an abstract timer.
Definition: timer.hpp:130
An I/O system timer.
Definition: timer.hpp:36
Timer(io_poll_t *poll, ev_exec_t *exec, clockid_t clockid)
Definition: timer.hpp:39
const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
Definition: ev.h:29
This header file is part of the I/O library; it contains the I/O system timer declarations.
io_timer_t * io_timer_create(io_poll_t *poll, ev_exec_t *exec, clockid_t clockid)
Creates a new I/O system timer.
Definition: timer.c:243
void io_timer_destroy(io_timer_t *timer)
Destroys an I/O system timer.
Definition: timer.c:270
An I/O polling interface.
Definition: poll.c:51
This header file is part of the I/O library; it contains the C++ interface for the abstract timer.