36#ifdef GECODE_HAS_FAULT_INJECTION
41 std::atomic<unsigned long long> fail_after_count;
42 std::atomic<unsigned long long> seen_count;
43 std::atomic<int> active_phase;
48 std::memory_order_release);
49 fail_after_count.store(0, std::memory_order_release);
50 seen_count.store(0, std::memory_order_release);
54 seen_count.store(0, std::memory_order_release);
55 fail_after_count.store(n, std::memory_order_release);
56 active_phase.store(
static_cast<int>(p), std::memory_order_release);
60 if (active_phase.load(std::memory_order_acquire) !=
static_cast<int>(p))
62 unsigned long long seen =
63 seen_count.fetch_add(1, std::memory_order_acq_rel);
64 if (seen >= fail_after_count.load(std::memory_order_acquire))
65 throw MemoryExhausted();
68 unsigned long long count(
void) {
69 return seen_count.load(std::memory_order_acquire);
Phase
Named phase for deterministic test failure injection.
void reset(void)
Reset all failpoint state.
void check(Phase p)
Check failpoint for phase p.
unsigned long long count(void)
Number of checks observed for the configured phase.
void fail_after(Phase p, unsigned long long n)
Fail after n successful checks for phase p.
Support algorithms and datastructures
Gecode toplevel namespace