Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
test
fuzz
util
threadinterrupt.h
Go to the documentation of this file.
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
#ifndef BITCOIN_TEST_FUZZ_UTIL_THREADINTERRUPT_H
6
#define BITCOIN_TEST_FUZZ_UTIL_THREADINTERRUPT_H
7
8
#include <
test/fuzz/FuzzedDataProvider.h
>
9
#include <util/threadinterrupt.h>
10
11
#include <memory>
12
16
class
FuzzedThreadInterrupt
:
public
CThreadInterrupt
17
{
18
public
:
19
explicit
FuzzedThreadInterrupt
(
FuzzedDataProvider
& fuzzed_data_provider);
20
21
virtual
bool
interrupted
()
const override
;
22
virtual
bool
sleep_for
(Clock::duration)
override
;
23
24
private
:
25
FuzzedDataProvider
&
m_fuzzed_data_provider
;
26
};
27
28
[[nodiscard]]
inline
std::shared_ptr<CThreadInterrupt>
ConsumeThreadInterrupt
(
FuzzedDataProvider
& fuzzed_data_provider)
29
{
30
return
std::make_shared<FuzzedThreadInterrupt>(fuzzed_data_provider);
31
}
32
33
#endif
// BITCOIN_TEST_FUZZ_UTIL_THREADINTERRUPT_H
FuzzedDataProvider.h
CThreadInterrupt::CThreadInterrupt
CThreadInterrupt()
Definition
threadinterrupt.cpp:10
FuzzedDataProvider
Definition
FuzzedDataProvider.h:32
FuzzedThreadInterrupt::interrupted
virtual bool interrupted() const override
Return true if operator()() has been called.
Definition
threadinterrupt.cpp:13
FuzzedThreadInterrupt::sleep_for
virtual bool sleep_for(Clock::duration) override
Sleep for the given duration.
Definition
threadinterrupt.cpp:18
FuzzedThreadInterrupt::FuzzedThreadInterrupt
FuzzedThreadInterrupt(FuzzedDataProvider &fuzzed_data_provider)
Definition
threadinterrupt.cpp:8
FuzzedThreadInterrupt::m_fuzzed_data_provider
FuzzedDataProvider & m_fuzzed_data_provider
Definition
threadinterrupt.h:25
ConsumeThreadInterrupt
std::shared_ptr< CThreadInterrupt > ConsumeThreadInterrupt(FuzzedDataProvider &fuzzed_data_provider)
Definition
threadinterrupt.h:28
Generated on
for Bitcoin Core by
1.17.0