Update
CI / GCC 16 / C++26 / werror (push) Failing after 3m9s
CI / GCC 16 / C++26 / sanitizers (push) Failing after 10m15s
CI / GCC 16 / C++26 / default (push) Failing after 13m1s

Signed-off-by: faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-07-20 01:18:53 +03:00
1 parent 8583a479dd
commit 3851aeb703
42 files changed
+6948 -759

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
#pragma once
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <chrono>
#include <memory>
#include <optional>
#include <vector>
namespace Void::Process
{
/// Converts process signals into synchronous, deterministic waits.
/// Construct this before worker threads so the selected signals inherit a
/// blocked mask. A watcher must be destroyed on the thread that created it.
class SignalWatcher
{
public:
/// An empty signal list watches SIGINT and SIGTERM.
[[nodiscard]] static Void::Result::Result<SignalWatcher>
create(std::vector<int> signals = {});
~SignalWatcher();
SignalWatcher(SignalWatcher&&) noexcept;
SignalWatcher& operator=(SignalWatcher&&) noexcept;
SignalWatcher(const SignalWatcher&) = delete;
SignalWatcher& operator=(const SignalWatcher&) = delete;
/// Wait for a configured signal. A zero timeout performs a poll;
/// milliseconds::max() waits indefinitely.
[[nodiscard]] Void::Result::Result<std::optional<int>>
wait(std::chrono::milliseconds timeout =
std::chrono::milliseconds::max());
[[nodiscard]] Void::Result::Result<std::optional<int>> poll();
private:
struct Impl;
std::unique_ptr<Impl> m_impl;
explicit SignalWatcher(std::unique_ptr<Impl> impl) noexcept;
};
} // namespace Void::Process