uvw
1.3.0
src
uvw
idle.hpp
1
#pragma once
2
3
4
#include <utility>
5
#include <memory>
6
#include <uv.h>
7
#include "handle.hpp"
8
#include "loop.hpp"
9
10
11
namespace
uvw
{
12
13
19
struct
IdleEvent
{};
20
21
37
class
IdleHandle
final:
public
Handle
<IdleHandle, uv_idle_t> {
38
static
void
startCallback(uv_idle_t *handle) {
39
IdleHandle
&idle = *(
static_cast<
IdleHandle
*
>
(handle->data));
40
idle.publish(
IdleEvent
{});
41
}
42
43
public
:
44
using
Handle::Handle;
45
50
bool
init
() {
51
return
initialize(&uv_idle_init);
52
}
53
60
void
start
() {
61
invoke(&uv_idle_start,
get
(), &startCallback);
62
}
63
67
void
stop
() {
68
invoke(&uv_idle_stop,
get
());
69
}
70
};
71
72
73
}
uvw::IdleHandle::start
void start()
Starts the handle.
Definition:
idle.hpp:60
uvw::IdleHandle::stop
void stop()
Stops the handle.
Definition:
idle.hpp:67
uvw::Handle
Handle base class.
Definition:
handle.hpp:29
uvw::IdleHandle::init
bool init()
Initializes the handle.
Definition:
idle.hpp:50
uvw::IdleHandle
The IdleHandle handle.
Definition:
idle.hpp:37
uvw::IdleEvent
IdleEvent event.
Definition:
idle.hpp:19
uvw
uvw default namespace.
Definition:
async.hpp:11
Generated by
1.8.13