Bitcoin Core 30.99.0
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
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. More...
 
virtual bool sleep_for (Clock::duration) override
 Sleep for the given duration. More...
 
- Public Member Functions inherited from CThreadInterrupt
 CThreadInterrupt ()
 
virtual ~CThreadInterrupt ()=default
 
virtual bool interrupted () const
 Return true if operator()() has been called. More...
 
virtual operator bool () const
 An alias for interrupted(). More...
 
virtual void operator() () EXCLUSIVE_LOCKS_REQUIRED(!mut)
 Interrupt any sleeps. After this interrupted() will return true. More...
 
virtual void reset ()
 Reset to an non-interrupted state. More...
 
virtual bool sleep_for (Clock::duration rel_time) EXCLUSIVE_LOCKS_REQUIRED(!mut)
 Sleep for the given duration. More...
 

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.

Here is the call graph for this function:

◆ 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: