userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
child_process.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <chrono>
7
8
#include <
userver/compiler/select.hpp
>
9
#include <
userver/engine/deadline.hpp
>
10
#include <
userver/engine/subprocess/child_process_status.hpp
>
11
#include <
userver/utils/fast_pimpl.hpp
>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
engine::subprocess {
16
17
class
ChildProcessImpl;
18
20
class
ChildProcess final {
21
public
:
23
explicit
ChildProcess(ChildProcessImpl&& impl)
noexcept
;
25
26
ChildProcess(ChildProcess&&)
noexcept
;
27
ChildProcess& operator=(ChildProcess&&)
noexcept
;
28
30
~ChildProcess
();
31
33
int
GetPid
()
const
;
34
37
void
Wait
();
38
42
template
<
typename
Rep,
typename
Period>
43
[[nodiscard]]
bool
WaitFor
(std::chrono::duration<Rep, Period> duration) {
44
return
WaitUntil
(
Deadline::FromDuration
(duration));
45
}
46
49
// happened; true otherwise.
50
template
<
typename
Clock,
typename
Duration>
51
[[nodiscard]]
bool
WaitUntil
(std::chrono::time_point<Clock, Duration> until) {
52
return
WaitUntil
(
Deadline::FromTimePoint
(until));
53
}
54
58
[[nodiscard]]
bool
WaitUntil
(
Deadline
deadline);
59
62
[[nodiscard]]
ChildProcessStatus
Get
();
63
65
void
SendSignal
(
int
signum);
66
67
private
:
68
static
constexpr
std::size_t kImplSize =
compiler::SelectSize
().For64Bit(24).For32Bit(12);
69
static
constexpr
std::size_t kImplAlignment =
alignof
(
void
*);
70
utils::FastPimpl<ChildProcessImpl, kImplSize, kImplAlignment>
impl_;
71
};
72
73
}
// namespace engine::subprocess
74
75
USERVER_NAMESPACE_END
userver
engine
subprocess
child_process.hpp
Generated on
for userver by
Doxygen
1.17.0