Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
FuzzedThreadInterrupt Class Reference

Mocked CThreadInterrupt that returns "randomly" whether it is interrupted and never sleeps. More...

#include <threadinterrupt.h>

Inheritance diagram for FuzzedThreadInterrupt:
[legend]
Collaboration diagram for FuzzedThreadInterrupt:
[legend]

Public Member Functions

 FuzzedThreadInterrupt (FuzzedDataProvider &fuzzed_data_provider)
virtual bool interrupted () const override
 Return true if operator()() has been called.
virtual bool sleep_for (Clock::duration) override
 Sleep for the given duration.
Public Member Functions inherited from CThreadInterrupt
 CThreadInterrupt ()
virtual ~CThreadInterrupt ()=default
virtual operator bool () const
 An alias for interrupted().
virtual void operator() () EXCLUSIVE_LOCKS_REQUIRED(!mut)
 Interrupt any sleeps. After this interrupted() will return true.
virtual void reset ()
 Reset to an non-interrupted state.

Private Attributes

FuzzedDataProviderm_fuzzed_data_provider

Additional Inherited Members

Public Types inherited from CThreadInterrupt
using Clock = std::chrono::steady_clock

Detailed Description

Mocked CThreadInterrupt that returns "randomly" whether it is interrupted and never sleeps.

Definition at line 16 of file threadinterrupt.h.

Constructor & Destructor Documentation

◆ FuzzedThreadInterrupt()

FuzzedThreadInterrupt::FuzzedThreadInterrupt ( FuzzedDataProvider & fuzzed_data_provider)
explicit

Definition at line 8 of file threadinterrupt.cpp.

Member Function Documentation

◆ interrupted()

bool FuzzedThreadInterrupt::interrupted ( ) const
overridevirtual

Return true if operator()() has been called.

Reimplemented from CThreadInterrupt.

Definition at line 13 of file threadinterrupt.cpp.

◆ sleep_for()

bool FuzzedThreadInterrupt::sleep_for ( Clock::duration rel_time)
overridevirtual

Sleep for the given duration.

Return values
trueThe time passed.
falseThe sleep was interrupted.

Reimplemented from CThreadInterrupt.

Definition at line 18 of file threadinterrupt.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ m_fuzzed_data_provider

FuzzedDataProvider& FuzzedThreadInterrupt::m_fuzzed_data_provider
private

Definition at line 25 of file threadinterrupt.h.


The documentation for this class was generated from the following files: