NCBI C++ ToolKit
|
#include <corelib/guard.hpp>
Go to the source code of this file.
Go to the SVN repository for this file.
Classes | |
class | CFutex |
Wrapper around Linux's futex. More... | |
class | CMiniMutex |
Mutex created to have minimum possible size (its size is 4 bytes) and to sleep using kernel capabilities (without busy-loops). More... | |
Macros | |
#define | ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) |
Purpose of this macro is to force compiler to access variable exactly at the place it's written (no moving around and changing places with other variables reads or writes) and to avoid optimizations when several usages of local variable are replaced with direct access to global variable which should be read/written only once. More... | |
Typedefs | |
typedef CGuard< CMiniMutex > | CMiniMutexGuard |
Functions | |
template<class T > | |
T | AtomicValCAS (T volatile &var, T old_value, T new_value) |
template<class T > | |
bool | AtomicCAS (T volatile &var, T old_value, T new_value) |
template<class T > | |
T | AtomicAdd (T volatile &var, T add_value) |
template<class T > | |
T | AtomicSub (T volatile &var, T sub_value) |
template<class T1 , class T2 , class T3 > | |
bool | AtomicCAS (T1 volatile &var, T2 old_value, T3 new_value) |
template<class T1 , class T2 > | |
T1 | AtomicAdd (T1 volatile &var, T2 add_value) |
template<class T1 , class T2 > | |
T1 | AtomicSub (T1 volatile &var, T2 sub_value) |
#define ACCESS_ONCE | ( | x | ) | (*(volatile typeof(x) *)&(x)) |
Purpose of this macro is to force compiler to access variable exactly at the place it's written (no moving around and changing places with other variables reads or writes) and to avoid optimizations when several usages of local variable are replaced with direct access to global variable which should be read/written only once.
Definition at line 51 of file srv_sync.hpp.
typedef CGuard<CMiniMutex> CMiniMutexGuard |
Definition at line 219 of file srv_sync.hpp.
Definition at line 69 of file srv_sync.hpp.
Referenced by SMMStat::AddStats(), CFutex::AddValue(), CWriteBackControl::AnotherServerMain(), AtomicAdd(), CNCBlobStorage::ChangeCacheDeadTime(), CNCStat::ClientBlobRollback(), CNCStat::ClientDataRead(), CNCStat::ClientDataWrite(), CSrvSocketTask::Connect(), CNCStat::DiskDataRead(), CNCStat::DiskDataWrite(), CSrvStat::ErrorOnSocket(), CNCStat::PeerDataRead(), CNCStat::PeerDataWrite(), CNCStat::PeerSyncFinished(), PromoteSockAmount(), CWriteBackControl::RecordNotifyUpdateBlob(), s_AddLogPrefix(), s_AllocBigPage(), s_AllocMemory(), s_AllocNewPage(), s_CreateListeningSocket(), s_CreateNewFile(), s_DeallocBigPage(), s_DeallocMemory(), s_GetKeyCacheData(), s_GetNextWriteCoord(), s_MoveRecToGarbageNoLock(), s_ProcessListenEvent(), s_ReleaseToFreePages(), s_SysAlloc(), s_SysAllocLongWay(), CSrvStat::SockOpenActive(), CSrvStat::SockOpenPassive(), CWriteBackControl::StartSyncBlob(), CSrvStat::ThreadStarted(), CSrvStat::ThreadStopped(), and CBlobCacher::x_PreCacheRecNums().
|
inline |
Definition at line 125 of file srv_sync.hpp.
References AtomicAdd().
Definition at line 62 of file srv_sync.hpp.
Referenced by AtomicCAS(), CFutex::ChangeValue(), CNCBlobVerManager::CNCBlobVerManager(), CNCDistributionConf::InitMirrorConfig(), MarkTaskTerminated(), CNCPeerControl::PeerHandshake(), RemoveTaskFromTimer(), CTaskServer::RequestShutdown(), CSrvTask::RunAfter(), s_ExecuteTimerTicket(), s_FindQueueThread(), s_MarkTaskExecuted(), s_MarkTaskRunning(), CSrvTask::SetRunnable(), CSpaceShrinker::x_CheckCurVersion(), CNCBlobVerManager::x_ReleaseMgr(), and SNCBlobVerData::x_WriteBlobInfo().
|
inline |
Definition at line 118 of file srv_sync.hpp.
References AtomicCAS().
Definition at line 76 of file srv_sync.hpp.
Referenced by AtomicSub(), CNCBlobStorage::ChangeCacheDeadTime(), CNCBlobStorage::ReleaseCacheData(), s_CloseSocket(), s_DeallocMemory(), s_DeleteDBFile(), s_ReleaseToFreePages(), s_SysFree(), and CBlobCacher::x_CacheMetaRec().
|
inline |
Definition at line 132 of file srv_sync.hpp.
References AtomicSub().