42extern std::atomic<bool> _isInterrupted;
44extern thread_local std::function<bool()> interruptCheck;
46Interrupted makeInterrupted();
49void inline checkInterrupt()
51 if (_isInterrupted || (interruptCheck && interruptCheck()))
66enum class DoSignalSave
69 DontSaveBecauseAdvancedProcess,
84void startSignalHandlerThread(DoSignalSave doSave = DoSignalSave::Save);
99void setChildSignalMask(sigset_t *sigs);
110std::unique_ptr<InterruptCallback> createInterruptCallback(
111 std::function<
void()> callback);
114kj::Promise<Result<T>> makeInterruptible(kj::Promise<Result<T>> p)
116 auto onInterrupt = kj::newPromiseAndCrossThreadFulfiller<Result<T>>();
117 auto interruptCallback = createInterruptCallback([fulfiller{onInterrupt.fulfiller.get()}] {
118 fulfiller->fulfill(result::failure(std::make_exception_ptr(makeInterrupted())));
120 return p.attach(std::move(onInterrupt.fulfiller), std::move(interruptCallback))
121 .exclusiveJoin(std::move(onInterrupt.promise));
124void triggerInterrupt();
131struct ReceiveInterrupts
134 std::unique_ptr<InterruptCallback> callback;
137 : target(pthread_self())
138 , callback(createInterruptCallback([&]() { pthread_kill(target, SIGUSR1); }))
This file defines two main structs/classes used in nix error handling.
Definition signals.hh:102