WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
Check.hpp
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <memory>
8
9#include <uv.h>
10
11#include "wpi/net/uv/Handle.hpp"
12#include "wpi/util/Signal.h"
13
14namespace wpi::net::uv {
15
16class Loop;
17
18/**
19 * Check handle.
20 * Check handles will generate a signal once per loop iteration, right
21 * after polling for I/O.
22 */
23class Check final : public HandleImpl<Check, uv_check_t> {
24 struct private_init {};
25
26 public:
27 explicit Check(const private_init&) {}
28 ~Check() noexcept override = default;
29
30 /**
31 * Create a check handle.
32 *
33 * @param loop Loop object where this handle runs.
34 */
35 static std::shared_ptr<Check> Create(Loop& loop);
36
37 /**
38 * Create a check handle.
39 *
40 * @param loop Loop object where this handle runs.
41 */
42 static std::shared_ptr<Check> Create(const std::shared_ptr<Loop>& loop) {
43 return Create(*loop);
44 }
45
46 /**
47 * Start the handle.
48 */
49 void Start();
50
51 /**
52 * Stop the handle. The signal will no longer be generated.
53 */
55
56 /**
57 * Signal generated once per loop iteration after polling for I/O.
58 */
60};
61
62} // namespace wpi::net::uv
void Start()
Start the handle.
void Stop()
Stop the handle.
Definition Check.hpp:54
Check(const private_init &)
Definition Check.hpp:27
static std::shared_ptr< Check > Create(Loop &loop)
Create a check handle.
wpi::util::sig::Signal check
Signal generated once per loop iteration after polling for I/O.
Definition Check.hpp:59
~Check() noexcept override=default
bool Invoke(F &&f, Args &&... args) const
Definition Handle.hpp:265
uv_check_t * GetRaw() const noexcept
Definition Handle.hpp:303
Event loop.
Definition Loop.hpp:35
Definition StringMap.hpp:773
Definition Prepare.hpp:14
SignalBase< detail::NullMutex, T... > Signal
Specialization of SignalBase to be used in single threaded contexts.
Definition Signal.h:809
UV_EXTERN int uv_check_stop(uv_check_t *check)