1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/// @file WASM stub for signals.cc
/// In the WASM evaluator there are no POSIX signals, no threads, and no
/// Ctrl-C interruption. All interrupt machinery is replaced with no-ops.
#include "lix/libutil/signals.hh"
#include "lix/libutil/error.hh"
#include <atomic>
#include <functional>
#include <memory>
namespace nix {
std::atomic_unsigned_lock_free _interruptSequence{0};
thread_local std::atomic_unsigned_lock_free::value_type threadInterruptSeq{0};
thread_local std::function<bool()> interruptCheck;
Interrupted makeInterrupted()
{
return Interrupted("interrupted by the user");
}
bool isInterrupted()
{
return false;
}
void _interrupted() {}
void unsetUserInterruptRequest() {}
void triggerInterrupt() {}
void saveSignalMask() {}
void startSignalHandlerThread() {}
void restoreSignals() {}
std::unique_ptr<InterruptCallback> createInterruptCallback(std::function<void()>)
{
// Return a no-op callback handle.
struct NoopCallback : InterruptCallback
{};
return std::make_unique<NoopCallback>();
}
} // namespace nix
|