NCBI C++ ToolKit
Classes | Macros | Typedefs | Functions
srv_sync.hpp File Reference
#include <corelib/guard.hpp>
+ Include dependency graph for srv_sync.hpp:
+ This graph shows which files directly or indirectly include this file:

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< CMiniMutexCMiniMutexGuard
 

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)
 

Macro Definition Documentation

◆ ACCESS_ONCE

#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 Documentation

◆ CMiniMutexGuard

Definition at line 219 of file srv_sync.hpp.

Function Documentation

◆ AtomicAdd() [1/2]

template<class T >
T AtomicAdd ( T volatile &  var,
T  add_value 
)
inline

◆ AtomicAdd() [2/2]

template<class T1 , class T2 >
T1 AtomicAdd ( T1 volatile &  var,
T2  add_value 
)
inline

Definition at line 125 of file srv_sync.hpp.

References AtomicAdd().

◆ AtomicCAS() [1/2]

template<class T >
bool AtomicCAS ( T volatile &  var,
T  old_value,
T  new_value 
)
inline

◆ AtomicCAS() [2/2]

template<class T1 , class T2 , class T3 >
bool AtomicCAS ( T1 volatile &  var,
T2  old_value,
T3  new_value 
)
inline

Definition at line 118 of file srv_sync.hpp.

References AtomicCAS().

◆ AtomicSub() [1/2]

template<class T >
T AtomicSub ( T volatile &  var,
T  sub_value 
)
inline

◆ AtomicSub() [2/2]

template<class T1 , class T2 >
T1 AtomicSub ( T1 volatile &  var,
T2  sub_value 
)
inline

Definition at line 132 of file srv_sync.hpp.

References AtomicSub().

◆ AtomicValCAS()

template<class T >
T AtomicValCAS ( T volatile &  var,
T  old_value,
T  new_value 
)
inline

Definition at line 55 of file srv_sync.hpp.

Modified on Wed Apr 17 13:08:57 2024 by modify_doxy.py rev. 669887