NCBI C++ ToolKit
Public Member Functions | Public Attributes | Private Member Functions | List of all members
CSrvRCUUser Class Referenceabstract

Search Toolkit Book for CSrvRCUUser

Class to derive from to use RCU mechanism. More...

#include "task_server.hpp"
(Private to src/app/netcache.)

+ Inheritance diagram for CSrvRCUUser:

Public Member Functions

void CallRCU (void)
 Method to be called to schedule call of ExecuteRCU() at appropriate time. More...
 
virtual void ExecuteRCU (void)=0
 Method implementing RCU job that was scheduled earlier by CallRCU(). More...
 
 CSrvRCUUser (void)
 
virtual ~CSrvRCUUser (void)
 

Public Attributes

TSrvRCUListHook m_RCUListHook
 

Private Member Functions

 CSrvRCUUser (const CSrvRCUUser &)
 
CSrvRCUUseroperator= (const CSrvRCUUser &)
 

Detailed Description

Class to derive from to use RCU mechanism.

For detailed explanation of RCU go to http://lse.sourceforge.net/locking/rcupdate.html. In short: if you want to do something which can race with other threads but you know when other threads exit current functions to return to TaskServer it will be already safe to do your job RCU is what you need. The most common use is deletion of an object pointer to which is obtained from somewhere and used locally in the same function and not remembered for later use.

Definition at line 74 of file task_server.hpp.

Constructor & Destructor Documentation

◆ CSrvRCUUser() [1/2]

CSrvRCUUser::CSrvRCUUser ( void  )

Definition at line 187 of file rcu.cpp.

◆ ~CSrvRCUUser()

CSrvRCUUser::~CSrvRCUUser ( void  )
virtual

Definition at line 190 of file rcu.cpp.

◆ CSrvRCUUser() [2/2]

CSrvRCUUser::CSrvRCUUser ( const CSrvRCUUser )
private

Member Function Documentation

◆ CallRCU()

void CSrvRCUUser::CallRCU ( void  )

Method to be called to schedule call of ExecuteRCU() at appropriate time.

CallRCU() cannot be called twice on the same object unless ExecuteRCU() was called in between those calls (it is safe to call CallRCU() from inside ExecutRCU() ).

Definition at line 194 of file rcu.cpp.

References SRCUInfo::calls, eThreadLockedForStop, eThreadStopped, GetCurThread(), m_RCUListHook, SSrvThread::rcu, SRV_FATAL, and thr.

Referenced by CNCActiveClientHub::Release(), s_DoTermination(), CSpaceShrinker::x_MoveRecord(), and SNCBlobVerData::x_WriteCurChunk().

◆ ExecuteRCU()

virtual void CSrvRCUUser::ExecuteRCU ( void  )
pure virtual

Method implementing RCU job that was scheduled earlier by CallRCU().

Implemented in SSrvThread, CMovedRecDeleter, CSrvTaskTerminator, CFakeRCUUser, CWBMemDeleter, SNCCacheData, and CNCActiveClientHub.

Referenced by s_RCUExecuteCalls().

◆ operator=()

CSrvRCUUser& CSrvRCUUser::operator= ( const CSrvRCUUser )
private

Member Data Documentation

◆ m_RCUListHook

TSrvRCUListHook CSrvRCUUser::m_RCUListHook

Definition at line 95 of file task_server.hpp.

Referenced by CallRCU().


The documentation for this class was generated from the following files:
Modified on Wed Apr 24 14:18:52 2024 by modify_doxy.py rev. 669887