uvw
1.15.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
38
class
IdleHandle
final:
public
Handle
<IdleHandle, uv_idle_t> {
39
static
void
startCallback(uv_idle_t *handle) {
40
IdleHandle
&idle = *(
static_cast<
IdleHandle
*
>
(handle->data));
41
idle.publish(
IdleEvent
{});
42
}
43
44
public
:
45
using
Handle::Handle;
46
51
bool
init
() {
52
return
initialize(&uv_idle_init);
53
}
54
61
void
start
() {
62
invoke(&uv_idle_start,
get
(), &startCallback);
63
}
64
68
void
stop
() {
69
invoke(&uv_idle_stop,
get
());
70
}
71
};
72
73
74
}
uvw::IdleHandle::start
void start()
Starts the handle.
Definition:
idle.hpp:61
uvw::IdleHandle::stop
void stop()
Stops the handle.
Definition:
idle.hpp:68
uvw::Handle
Handle base class.
Definition:
handle.hpp:29
uvw::IdleHandle::init
bool init()
Initializes the handle.
Definition:
idle.hpp:51
uvw::IdleHandle
The IdleHandle handle.
Definition:
idle.hpp:38
uvw::IdleEvent
IdleEvent event.
Definition:
idle.hpp:19
uvw
uvw default namespace.
Definition:
async.hpp:11
Generated by
1.8.13