SPH
Process.h
Go to the documentation of this file.
1 #pragma once
2 
7 
8 #include "io/Path.h"
11 
13 
19 class Process {
20 private:
21  pid_t childPid = -1;
22 
23 public:
25  Process() = default;
26 
32  Process(const Path& path, Array<std::string>&& args);
33 
35  void wait();
36 
39  void waitFor(const uint64_t duration);
40 
44  void waitUntil(const Function<bool()>& condition, const uint64_t checkEvery = 100);
45 };
46 
Generic dynamically allocated resizable storage.
NAMESPACE_SPH_BEGIN
Definition: BarnesHut.cpp:13
Generic wrappers of lambdas, functors and other callables.
#define NAMESPACE_SPH_END
Definition: Object.h:12
Object representing a path on a filesystem, similar to std::filesystem::path in c++17.
Object representing a path on a filesystem.
Definition: Path.h:17
Holds a handle to a created process.
Definition: Process.h:19
void wait()
Blocks the calling thread until the managed process exits. The function may block indefinitely.
Definition: Process.cpp:50
void waitUntil(const Function< bool()> &condition, const uint64_t checkEvery=100)
Blocks the calling thread until the managed process exits or until given condition is met.
void waitFor(const uint64_t duration)
Blocks the calling thread until the managed process exits or for specified duration.
Process()=default
Creates a null process handle.