NCBI C++ ToolKit
Classes | Typedefs | Functions | Variables | Friends
Atomic Counters
+ Collaboration diagram for Atomic Counters:

Classes

class  CAtomicCounter
 CAtomicCounter –. More...
 
class  CAtomicCounter_WithAutoInit
 CAtomicCounter_WithAutoInit –. More...
 
class  CMutableAtomicCounter
 CMutableAtomicCounter –. More...
 

Typedefs

typedef TNCBIAtomicValue CAtomicCounter::TValue
 Alias TValue for TNCBIAtomicValue. More...
 
typedef CAtomicCounter::TValue CMutableAtomicCounter::TValue
 Alias TValue simplifies syntax. More...
 

Functions

TValue CAtomicCounter::Get (void) const THROWS_NONE
 Get atomic counter value. More...
 
void CAtomicCounter::Set (TValue new_value) THROWS_NONE
 Set atomic counter value. More...
 
TValue CAtomicCounter::Add (int delta) THROWS_NONE
 Atomically add value (=delta), and return new counter value. More...
 
typedef CAtomicCounter::NCBI_ATOMIC_TYPE (TValue) TData
 Define NCBI_COUNTER_ADD if one has not been defined. More...
 
 CAtomicCounter_WithAutoInit::CAtomicCounter_WithAutoInit (TValue initial_value=0)
 
TValue CMutableAtomicCounter::Get (void) const THROWS_NONE
 Get atomic counter value. More...
 
void CMutableAtomicCounter::Set (TValue new_value) const THROWS_NONE
 Set atomic counter value. More...
 
TValue CMutableAtomicCounter::Add (int delta) const THROWS_NONE
 Atomically add value (=delta), and return new counter value. More...
 

Variables

volatile TData CAtomicCounter::m_Value
 Internal counter value. More...
 
CAtomicCounter CMutableAtomicCounter::m_Counter
 Mutable atomic counter value. More...
 

Friends

class CAtomicCounter::CObject
 

Detailed Description

Typedef Documentation

◆ TValue [1/2]

Alias TValue for TNCBIAtomicValue.

Definition at line 73 of file ncbicntr.hpp.

◆ TValue [2/2]

Alias TValue simplifies syntax.

Definition at line 141 of file ncbicntr.hpp.

Function Documentation

◆ Add() [1/2]

TValue CMutableAtomicCounter::Add ( int  delta) const
inline

Atomically add value (=delta), and return new counter value.

Definition at line 152 of file ncbicntr.hpp.

References CAtomicCounter::Add(), delta(), and CMutableAtomicCounter::m_Counter.

◆ Add() [2/2]

CAtomicCounter::TValue CAtomicCounter::Add ( int  delta)
inline

Atomically add value (=delta), and return new counter value.

Definition at line 278 of file ncbicntr.hpp.

References delta(), and NCBI_COUNTER_ADD.

Referenced by CMutableAtomicCounter::Add(), CNCSyncLog::AddEvent(), CNCMMChunksPool::AddRef(), CNCMMChainsPool::AddRef(), CThreadPool_Impl::AddTask(), CDownloadJob::CDownloadCallbackData::Cancel(), CGBWorkspace::CGBWorkspace(), CNCSyncLog::Clean(), CFeatureGenerator::ConvertLocToAnnot(), CStatisticsCounters::CountDBDeletion(), CStatisticsCounters::CountNSGetRollback(), CStatisticsCounters::CountNSReadRollback(), CStatisticsCounters::CountNSSubmitRollback(), CStatisticsCounters::CountOutdatedPick(), CStatisticsCounters::CountRedo(), CStatisticsCounters::CountReread(), CThreadInPool< TRequest >::CountSelf(), CThreadInPool_ForServer::CountSelf(), CStatisticsCounters::CountSubmit(), CStatisticsCounters::CountToPendingRescheduled(), CStatisticsCounters::CountToPendingWithoutBlacklist(), CStatisticsCounters::CountTransition(), CStatisticsCounters::CountTransitionToDeleted(), CProjectFolder::CProjectFolder(), CQuickAndDirtySamePointerGuard< T >::CQuickAndDirtySamePointerGuard(), CTestThread::CTestThread(), CWorkspaceFolder::CWorkspaceFolder(), CNetScheduleServer::DecrementCurrentSubmitsCounter(), CParamBase::EnableConfigDump(), CHookDataBase::ForgetLocalHook(), CNCDistributionConf::GenerateBlobKey(), COrdinalFeatIdGenerator::GenerateId(), GetBlobReader(), CNCBlobStorage::GetNewBlobId(), CGridGlobals::GetNewJobNumber(), CBDB_Cache::GetNextBlobId(), CGBProjectHandle::GetNextId(), CRequestContext::GetNextRequestID(), CDiagContext::GetProcessPostNumber(), CDataSource::GetTSE_LoadLockIfLoaded(), CTestThread::GlobalSyncPoint(), CThreadGroup::Go(), CNetScheduleServer::IncrementCurrentSubmitsCounter(), CProSplignInterrupt::Interrupt(), ITextItem::ITextItem(), CThreadPool_Impl::LaunchThreads(), CAsyncDiagThread::Main(), CTotalRangeThread::Main(), CMakeCdrProds::MakeCdrProds(), SNetStorageRPC::MkStdRequest(), CThreadPool_ServiceThread::NeedCallController(), CIdleWatcher::Notify(), CTSE_LoadLock::operator=(), CNCBlobAccessor::PutFailed(), CNCBlobAccessor::PutSucceeded(), CFastRWLock::ReadLock(), CFastRWLock::ReadUnlock(), CNCMMChunksPool::ReleaseRef(), CNCMMChainsPool::ReleaseRef(), CThreadNonStop::RequestStop(), CJobQueueCleanerThread::RequestStop(), CJobQueueExecutionWatcherThread::RequestStop(), CTSE_LoadLock::Reset(), CHookDataBase::ResetGlobalHook(), CHookDataBase::ResetLocalHook(), CHookDataBase::ResetPathHook(), map_checker< std::map< string, string, less< string > > >::RLock(), multimap_checker< std::multimap< time_t, CFileLoadDescriptor, less< time_t > > >::RLock(), set< ETranslationFrame >::RLock(), multiset< TIndexKey, PIndexBySecondLess >::RLock(), map_checker< std::map< string, string, less< string > > >::RUnlock(), multimap_checker< std::multimap< time_t, CFileLoadDescriptor, less< time_t > > >::RUnlock(), set< ETranslationFrame >::RUnlock(), multiset< TIndexKey, PIndexBySecondLess >::RUnlock(), s_GetNextWriteCoord(), s_SaveOneMapImpl(), CNetScheduleServer::SetDrainShutdown(), CHookDataBase::SetGlobalHook(), CHookDataBase::SetLocalHook(), CHookDataBase::SetPathHook(), CIdMapperComposite::SNode::SNode(), SNetScheduleAPIImpl::StartNotificationThread(), CNSTDBConnectionThread::Stop(), CTypeRef::sx_GetResolve(), CThreadPool_Impl::TaskFinished(), CThreadPool_Impl::TaskStarting(), CThreadPool_Impl::ThreadStopped(), CThreadGroup::ThreadWait(), CFeatureGenerator::SImplementation::TransformProteinAlignToTranscript(), CCacheWithLock< Key, Value, Less >::Unlock(), CBinaryRangeCacheWithLock< Position, Value >::Unlock(), CTypeRef::Unref(), map_checker< std::map< string, string, less< string > > >::WLock(), multimap_checker< std::multimap< time_t, CFileLoadDescriptor, less< time_t > > >::WLock(), set< ETranslationFrame >::WLock(), multiset< TIndexKey, PIndexBySecondLess >::WLock(), CNCBlobStorage::WriteBlobInfo(), CNCBlobStorage::WriteChunkData(), CFastRWLock::WriteLock(), CFastRWLock::WriteUnlock(), map_checker< std::map< string, string, less< string > > >::WUnlock(), multimap_checker< std::multimap< time_t, CFileLoadDescriptor, less< time_t > > >::WUnlock(), set< ETranslationFrame >::WUnlock(), multiset< TIndexKey, PIndexBySecondLess >::WUnlock(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::x_AddKeyRef(), CNCPeerControl::x_AddMirrorEvent(), CScheduler_MT::x_AddQueueTask(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::x_AssignKeyRef(), CId2ReaderBase::x_AssignSerialNumbers(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::x_CreateNode(), CRemoteAppRequest::x_CreateWDir(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::x_DeleteKey(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::x_DeleteNode(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::x_DerefKey(), CNCPeerControl::x_DoReleaseConn(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::x_FinalizeCallContext(), CSafeStaticPtr_Base::x_GetCreationOrder(), CDiagContext::x_GetNextHitID(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::x_GetRootAndHeight(), CThreadPool_ServiceThread::x_Idle(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::x_InsertLeafValue(), CSyncQueue< Type, Container, Traits >::x_LockAndWait(), CRequestContext::x_Modify(), CSpaceShrinker::x_MoveRecord(), CCDDClientPool::x_NextSerialNumber(), CFastCgiApplicationMT::x_ProcessThreadedRequest(), CThreadPool_Task::x_ResetOwner(), CDataSource::x_SetLoadLock(), CThreadPool_Task::x_SetOwner(), CNCPeerControl::x_SlotsInitiallySynced(), CNCPeerControl::x_SrvInitiallySynced(), CThreadInPool< TRequest >::x_UnregisterThread(), CQuickAndDirtySamePointerGuard< T >::~CQuickAndDirtySamePointerGuard(), CThreadInPool_ForServer::~CThreadInPool_ForServer(), ITextItem::~ITextItem(), and SNetScheduleAPIImpl::~SNetScheduleAPIImpl().

◆ CAtomicCounter_WithAutoInit()

CAtomicCounter_WithAutoInit::CAtomicCounter_WithAutoInit ( TValue  initial_value = 0)
inline

Definition at line 122 of file ncbicntr.hpp.

References CAtomicCounter::Set().

◆ Get() [1/2]

CAtomicCounter::TValue CAtomicCounter::Get ( void  ) const
inline

Get atomic counter value.

Definition at line 168 of file ncbicntr.hpp.

References NCBI_SCHED_SPIN_INIT, NCBI_SCHED_SPIN_YIELD, and rapidjson::value.

Referenced by CProSplignInterrupt::CheckUserInterrupt(), CCacheWithLock< Key, Value, Less >::CLock::CLock(), CTextPanel::CTextPanel(), SNetServerConnectionImpl::DeleteThis(), CHookDataBase::Empty(), CConnTestThread::Finished(), CHookDataBase::ForgetLocalHook(), CMutableAtomicCounter::Get(), CDownloadJob::CDownloadCallbackData::GetCancel(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::GetCntLeafNodes(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::GetCntNodes(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::GetCntValues(), SNetServerInPool::GetConnectionFromPool(), CNetScheduleServer::GetCurrentSubmitsCounter(), CGBProjectHandle::GetDataModified(), CThreadPool_Impl::GetExecutingTasksCount(), CCgiApplication::GetFCgiIteration(), CNCSyncLog::GetLogSize(), CNCPeerControl::GetMirrorQueueSize(), CDownloadJob::CDownloadCallbackData::GetPos(), CDiagContext::GetProcessPostNumber(), CThreadPool_Impl::GetThreadsCount(), CTestThread::GlobalSyncPoint(), CNCBlobAccessor::HasPutSucceeded(), CNCPeerControl::HasServersForInitSync(), CHookDataBase::HaveHooks(), CAsyncCall::Call::IsCancalable(), CAsyncCall::Call::IsCanceled(), CCanceledImpl::IsCanceled(), CConnTestThread::IsCanceled(), CGBProjectHandle::IsDirty(), CNetScheduleServer::IsDrainShutdown(), CGBProjectHandle::IsLoaded(), CTSE_Info::IsLocked(), CThreadNonStop::IsStopRequested(), CStdPoolOfThreads::KillAllThreads(), CThreadNonStop::Main(), CJobQueueCleanerThread::Main(), CJobQueueExecutionWatcherThread::Main(), CNSTDBConnectionThread::Main(), CAsyncDiagThread::Main(), CTotalRangeThread::Main(), CThreadPool_Task::operator=(), CStatisticsCounters::PrintDelta(), CStatisticsCounters::PrintTransitions(), CNCBlobAccessor::PutSucceeded(), CStdPoolOfThreads::Register(), CHookDataBase::ResetGlobalHook(), CHookDataBase::ResetLocalHook(), map_checker< std::map< string, string, less< string > > >::RLock(), multimap_checker< std::multimap< time_t, CFileLoadDescriptor, less< time_t > > >::RLock(), set< ETranslationFrame >::RLock(), multiset< TIndexKey, PIndexBySecondLess >::RLock(), map_checker< std::map< string, string, less< string > > >::RUnlock(), multimap_checker< std::multimap< time_t, CFileLoadDescriptor, less< time_t > > >::RUnlock(), set< ETranslationFrame >::RUnlock(), multiset< TIndexKey, PIndexBySecondLess >::RUnlock(), CStackTrace::s_GetStackTraceMaxDepth(), CHookDataBase::SetGlobalHook(), CHookDataBase::SetLocalHook(), CThreadGroup::ThreadWait(), CThreadPool_Impl::TryGetExclusiveTask(), CStdPoolOfThreads::UnRegister(), map_checker< std::map< string, string, less< string > > >::WLock(), multimap_checker< std::multimap< time_t, CFileLoadDescriptor, less< time_t > > >::WLock(), set< ETranslationFrame >::WLock(), multiset< TIndexKey, PIndexBySecondLess >::WLock(), CFastRWLock::WriteLock(), map_checker< std::map< string, string, less< string > > >::WUnlock(), multimap_checker< std::multimap< time_t, CFileLoadDescriptor, less< time_t > > >::WUnlock(), set< ETranslationFrame >::WUnlock(), multiset< TIndexKey, PIndexBySecondLess >::WUnlock(), CId2ReaderBase::x_AssignSerialNumbers(), CBlobCacher::x_CacheMetaRec(), CThreadPool_Impl::x_CanAddImmediateTask(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::x_CanShrinkTree(), CNSTDBConnectionThread::x_CreateDatabase(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::x_Finalize(), CSpaceShrinker::x_MoveRecord(), CSpaceShrinker::x_PrepareToShrink(), CFastCgiApplicationMT::x_ProcessThreadedRequest(), CNSTDBConnectionThread::x_RestoreConnection(), CFastCgiApplicationMT::x_RunFastCGI(), CSchedulerEngine::x_WorkOnThread(), CHookDataBase::~CHookDataBase(), CPoolOfThreads_ForServer::~CPoolOfThreads_ForServer(), CSQLITE3_Cache::~CSQLITE3_Cache(), CTextPanel::~CTextPanel(), CTextRetrieveJob::~CTextRetrieveJob(), CTSE_Info::~CTSE_Info(), CTypeInfoSource::~CTypeInfoSource(), and SNCCacheData::~SNCCacheData().

◆ Get() [2/2]

TValue CMutableAtomicCounter::Get ( void  ) const
inline

Get atomic counter value.

Definition at line 144 of file ncbicntr.hpp.

References CAtomicCounter::Get(), and CMutableAtomicCounter::m_Counter.

◆ NCBI_ATOMIC_TYPE()

typedef CAtomicCounter::NCBI_ATOMIC_TYPE ( TValue  )
private

Define NCBI_COUNTER_ADD if one has not been defined.

◆ Set() [1/2]

void CMutableAtomicCounter::Set ( TValue  new_value) const
inline

Set atomic counter value.

Definition at line 148 of file ncbicntr.hpp.

References CMutableAtomicCounter::m_Counter, and CAtomicCounter::Set().

◆ Set() [2/2]

void CAtomicCounter::Set ( CAtomicCounter::TValue  new_value)
inline

Set atomic counter value.

Definition at line 185 of file ncbicntr.hpp.

Referenced by BOOST_AUTO_TEST_CASE(), CAsyncDiagThread::CAsyncDiagThread(), CAtomicCounter_WithAutoInit::CAtomicCounter_WithAutoInit(), CCgiApplication::CCgiApplication(), CFastCgiApplicationMT::CFastCgiApplicationMT(), CGBProjectHandle::Clear(), CNetScheduleServer::CNetScheduleServer(), COrdinalFeatIdGenerator::COrdinalFeatIdGenerator(), CPoolOfThreads_ForServer::CPoolOfThreads_ForServer(), CProSplignInterrupt::CProSplignInterrupt(), CScheduler_MT::CScheduler_MT(), CCacheWithLock< Key, Value, Less >::CSlot::CSlot(), CBinaryRangeCacheWithLock< Position, Value >::CSlot::CSlot(), CStatisticsCounters::CStatisticsCounters(), CThreadPool_ServiceThread::CThreadPool_ServiceThread(), CBDB_Cache::GetNextBlobId(), CTestThread::GlobalSyncPoint(), CNCBlobStorage::Initialize(), CNCSyncLog::Initialize(), CNCDistributionConf::Initialize(), CNCPeerControl::Initialize(), CNCMMChunksPool::InitInstance(), CNCMMChainsPool::InitInstance(), CAsyncCall::Call::IsCanceled(), CStdPoolOfThreads::KillAllThreads(), CConnTestThread::Main(), CBDB_Cache::Open(), CCanceledImpl::RequestCancel(), CConnTestThread::RequestCancel(), CAsyncCall::Call::RequestCancel(), CStackTrace::s_GetStackTraceMaxDepth(), CMutableAtomicCounter::Set(), CGBProjectHandle::SetLoaded(), CDownloadJob::CDownloadCallbackData::SetPos(), CNCPeerControl::SetServersForInitSync(), CSchedulerEngine::ShutDown(), SNCDBFileInfo::SNCDBFileInfo(), SNetServerInPool::SNetServerInPool(), SNetStorageRPC::SNetStorageRPC(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::x_AssignKeyRef(), CId2ReaderBase::x_AssignSerialNumbers(), CNCMMCentral::x_CalcMemoryMode(), CThreadPool_Impl::x_Init(), CSeqMasterIndex::x_Init(), CSeqMasterIndex::x_Initialize(), CConcurrentMap< Key, Value, Comparator, Allocator, CntChildsInNode, MaxTreeHeight, DeletionDelay, DelStoreCapacity >::x_Initialize(), and CFastCgiApplicationMT::x_ProcessThreadedRequest().

Variable Documentation

◆ m_Counter

CAtomicCounter CMutableAtomicCounter::m_Counter
mutableprivate

Mutable atomic counter value.

Definition at line 156 of file ncbicntr.hpp.

Referenced by CMutableAtomicCounter::Add(), CMutableAtomicCounter::Get(), and CMutableAtomicCounter::Set().

◆ m_Value

volatile TData CAtomicCounter::m_Value
private

Internal counter value.

Definition at line 101 of file ncbicntr.hpp.

Friends

◆ CObject

friend class CObject
friend

Definition at line 105 of file ncbicntr.hpp.

Modified on Fri Sep 20 14:57:06 2024 by modify_doxy.py rev. 669887