uvw  1.3.0
check.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 CheckEvent {};
20 
21 
30 class CheckHandle final: public Handle<CheckHandle, uv_check_t> {
31  static void startCallback(uv_check_t *handle) {
32  CheckHandle &check = *(static_cast<CheckHandle*>(handle->data));
33  check.publish(CheckEvent{});
34  }
35 
36 public:
37  using Handle::Handle;
38 
43  bool init() {
44  return initialize(&uv_check_init);
45  }
46 
53  void start() {
54  invoke(&uv_check_start, get(), &startCallback);
55  }
56 
60  void stop() {
61  invoke(&uv_check_stop, get());
62  }
63 };
64 
65 
66 }
void stop()
Stops the handle.
Definition: check.hpp:60
void start()
Starts the handle.
Definition: check.hpp:53
CheckEvent event.
Definition: check.hpp:19
Handle base class.
Definition: handle.hpp:29
bool init()
Initializes the handle.
Definition: check.hpp:43
The CheckHandle handle.
Definition: check.hpp:30
uvw default namespace.
Definition: async.hpp:11