/root/bitcoin/src/test/fuzz/util/threadinterrupt.cpp
Line | Count | Source |
1 | | // Copyright (c) 2024-present The Bitcoin Core developers |
2 | | // Distributed under the MIT software license, see the accompanying |
3 | | // file COPYING or http://www.opensource.org/licenses/mit-license.php. |
4 | | |
5 | | #include <test/fuzz/util.h> |
6 | | #include <test/fuzz/util/threadinterrupt.h> |
7 | | |
8 | | FuzzedThreadInterrupt::FuzzedThreadInterrupt(FuzzedDataProvider& fuzzed_data_provider) |
9 | 0 | : m_fuzzed_data_provider{fuzzed_data_provider} |
10 | 0 | { |
11 | 0 | } |
12 | | |
13 | | bool FuzzedThreadInterrupt::interrupted() const |
14 | 0 | { |
15 | 0 | return m_fuzzed_data_provider.ConsumeBool(); |
16 | 0 | } |
17 | | |
18 | | bool FuzzedThreadInterrupt::sleep_for(Clock::duration) |
19 | 0 | { |
20 | 0 | SetMockTime(ConsumeTime(m_fuzzed_data_provider)); // Time could go backwards. |
21 | 0 | return m_fuzzed_data_provider.ConsumeBool(); |
22 | 0 | } |