Bitcoin Core  0.20.99
P2P Digital Currency
Classes | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
MainSignalsInstance Struct Reference

The MainSignalsInstance manages a list of shared_ptr<CValidationInterface> callbacks. More...

Collaboration diagram for MainSignalsInstance:
[legend]

Classes

struct  ListEntry
 List entries consist of a callback pointer and reference count. More...
 

Public Member Functions

 MainSignalsInstance (CScheduler *pscheduler)
 
void Register (std::shared_ptr< CValidationInterface > callbacks)
 
void Unregister (CValidationInterface *callbacks)
 
void Clear ()
 Clear unregisters every previously registered callback, erasing every map entry. More...
 
template<typename F >
void Iterate (F &&f)
 

Public Attributes

SingleThreadedSchedulerClient m_schedulerClient
 

Private Member Functions

std::list< ListEntry > m_list GUARDED_BY (m_mutex)
 
std::unordered_map< CValidationInterface *, std::list< ListEntry >::iterator > m_map GUARDED_BY (m_mutex)
 

Private Attributes

Mutex m_mutex
 

Detailed Description

The MainSignalsInstance manages a list of shared_ptr<CValidationInterface> callbacks.

A std::unordered_map is used to track what callbacks are currently registered, and a std::list is to used to store the callbacks that are currently registered as well as any callbacks that are just unregistered and about to be deleted when they are done executing.

Definition at line 26 of file validationinterface.cpp.

Constructor & Destructor Documentation

◆ MainSignalsInstance()

MainSignalsInstance::MainSignalsInstance ( CScheduler pscheduler)
inlineexplicit

Definition at line 43 of file validationinterface.cpp.

Here is the caller graph for this function:

Member Function Documentation

◆ Clear()

void MainSignalsInstance::Clear ( )
inline

Clear unregisters every previously registered callback, erasing every map entry.

After this call, the list may still contain callbacks that are currently executing, but it will be cleared when they are done executing.

Definition at line 67 of file validationinterface.cpp.

◆ GUARDED_BY() [1/2]

std::list<ListEntry> m_list MainSignalsInstance::GUARDED_BY ( m_mutex  )
private

◆ GUARDED_BY() [2/2]

std::unordered_map<CValidationInterface*, std::list<ListEntry>::iterator> m_map MainSignalsInstance::GUARDED_BY ( m_mutex  )
private

◆ Iterate()

template<typename F >
void MainSignalsInstance::Iterate ( F &&  f)
inline

Definition at line 76 of file validationinterface.cpp.

◆ Register()

void MainSignalsInstance::Register ( std::shared_ptr< CValidationInterface callbacks)
inline

Definition at line 45 of file validationinterface.cpp.

◆ Unregister()

void MainSignalsInstance::Unregister ( CValidationInterface callbacks)
inline

Definition at line 53 of file validationinterface.cpp.

Member Data Documentation

◆ m_mutex

Mutex MainSignalsInstance::m_mutex
private

Definition at line 28 of file validationinterface.cpp.

◆ m_schedulerClient

SingleThreadedSchedulerClient MainSignalsInstance::m_schedulerClient

Definition at line 41 of file validationinterface.cpp.


The documentation for this struct was generated from the following file: