uvw
1.10.0
src
uvw
async.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
AsyncEvent
{};
20
21
30
class
AsyncHandle
final:
public
Handle
<AsyncHandle, uv_async_t> {
31
static
void
sendCallback(uv_async_t *handle) {
32
AsyncHandle
&async = *(
static_cast<
AsyncHandle
*
>
(handle->data));
33
async.publish(
AsyncEvent
{});
34
}
35
36
public
:
37
using
Handle::Handle;
38
47
bool
init
() {
48
return
initialize(&uv_async_init, &sendCallback);
49
}
50
61
void
send
() {
62
invoke(&uv_async_send,
get
());
63
}
64
};
65
66
67
}
uvw::AsyncHandle::send
void send()
Wakeups the event loop and emits the AsyncEvent event.
Definition:
async.hpp:61
uvw::Handle
Handle base class.
Definition:
handle.hpp:29
uvw::AsyncHandle
The AsyncHandle handle.
Definition:
async.hpp:30
uvw::AsyncEvent
AsyncEvent event.
Definition:
async.hpp:19
uvw::AsyncHandle::init
bool init()
Initializes the handle.
Definition:
async.hpp:47
uvw
uvw default namespace.
Definition:
async.hpp:11
Generated by
1.8.13