Bitcoin ABC  0.29.2
P2P Digital Currency
Classes | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
RCUInfos Class Reference

#include <rcu.h>

Collaboration diagram for RCUInfos:
[legend]

Classes

class  RCUCleanupGuard
 

Private Member Functions

 RCUInfos ()
 
 ~RCUInfos ()
 
void readLock ()
 
void readFree ()
 
bool isLocked () const
 
void registerCleanup (const std::function< void()> &f)
 
void synchronize ()
 
void runCleanups ()
 
uint64_t hasSyncedTo (uint64_t cutoff=UNLOCKED)
 

Private Attributes

std::atomic< uint64_t > state
 
std::atomic< RCUInfos * > next
 
bool isCleaningUp = false
 
std::map< uint64_t, std::function< void()> > cleanups
 

Static Private Attributes

static const uint64_t UNLOCKED = -uint64_t(1)
 
static std::atomic< uint64_t > revision {0}
 
static thread_local RCUInfos infos {}
 

Friends

class RCULock
 
struct RCUTest
 

Detailed Description

Definition at line 20 of file rcu.h.

Constructor & Destructor Documentation

◆ RCUInfos()

RCUInfos::RCUInfos ( )
private

Definition at line 107 of file rcu.cpp.

Here is the call graph for this function:

◆ ~RCUInfos()

RCUInfos::~RCUInfos ( )
private

Before the thread is removed from the list, make sure we cleanup everything.

We have our node and the parent is ready to be updated. NB: The CAS operation only checks for *ptr and not for next. This would be a big problem in the general case, but because we only insert at the tip of the list and cannot have concurrent deletion thanks to the use of a mutex, we are safe.

We now wait for possible readers to go past the synchronization point. We need to do so while holding the lock as this operation require us to a be a reader, but we just removed ourselves from the list of reader to check and may therefore not be waited for.

Definition at line 117 of file rcu.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ hasSyncedTo()

uint64_t RCUInfos::hasSyncedTo ( uint64_t  cutoff = UNLOCKED)
private

Definition at line 235 of file rcu.cpp.

Here is the caller graph for this function:

◆ isLocked()

bool RCUInfos::isLocked ( ) const
inlineprivate

Definition at line 45 of file rcu.h.

Here is the caller graph for this function:

◆ readFree()

void RCUInfos::readFree ( )
inlineprivate

Definition at line 40 of file rcu.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readLock()

void RCUInfos::readLock ( )
inlineprivate

Definition at line 35 of file rcu.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerCleanup()

void RCUInfos::registerCleanup ( const std::function< void()> &  f)
inlineprivate

Definition at line 46 of file rcu.h.

Here is the caller graph for this function:

◆ runCleanups()

void RCUInfos::runCleanups ( )
private

Definition at line 208 of file rcu.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ synchronize()

void RCUInfos::synchronize ( )
private

Definition at line 169 of file rcu.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ RCULock

friend class RCULock
friend

Definition at line 54 of file rcu.h.

◆ RCUTest

friend struct RCUTest
friend

Definition at line 55 of file rcu.h.

Member Data Documentation

◆ cleanups

std::map<uint64_t, std::function<void()> > RCUInfos::cleanups
private

Definition at line 27 of file rcu.h.

◆ infos

thread_local RCUInfos RCUInfos::infos {}
staticprivate

Definition at line 58 of file rcu.h.

◆ isCleaningUp

bool RCUInfos::isCleaningUp = false
private

Definition at line 24 of file rcu.h.

◆ next

std::atomic<RCUInfos *> RCUInfos::next
private

Definition at line 22 of file rcu.h.

◆ revision

std::atomic< uint64_t > RCUInfos::revision {0}
staticprivate

Definition at line 57 of file rcu.h.

◆ state

std::atomic<uint64_t> RCUInfos::state
private

Definition at line 21 of file rcu.h.

◆ UNLOCKED

const uint64_t RCUInfos::UNLOCKED = -uint64_t(1)
staticprivate

Definition at line 30 of file rcu.h.


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