NCBI C++ ToolKit
Classes | Macros | Typedefs | Enumerations | Enumerator | Functions | Variables | Friends
Threads
+ Collaboration diagram for Threads:

Classes

class  CThreadSystemID
 CThreadSystemID –. More...
 
class  CMutexException
 CMutexException –. More...
 
struct  ncbi_namespace_mutex_mt::SSystemFastMutex
 
struct  ncbi_namespace_mutex_mt::SSystemMutex
 
class  CFastMutex
 CFastMutex –. More...
 
class  CMutex
 CMutex –. More...
 
class  CSpinLock
 CSpinLock –. More...
 
struct  SSimpleReadLock< Class >
 SSimpleReadLock –. More...
 
struct  SSimpleWriteLock< Class >
 SSimpleWriteLock –. More...
 
class  CRWLock
 CRWLock –. More...
 
struct  SSimpleReadUnlock< Class >
 SSimpleReadUnlock –. More...
 
struct  SSimpleWriteUnlock< Class >
 SSimpleWriteUnlock –. More...
 
class  CFastRWLock
 CFastRWLock –. More...
 
class  IRWLockHolder_Listener
 Interface for receiving messages about state changes in CRWLockHolder. More...
 
class  IRWLockHolder_Factory
 Interface for factory creating CRWLockHolder objects. More...
 
class  CRWLockHolder
 Holder of the lock inside CYieldingRWLock. More...
 
class  CYieldingRWLock
 Read/write lock without blocking calls. More...
 
class  CSemaphore
 CSemaphore –. More...
 
class  CConditionVariable
 
class  CConditionVariableException
 CConditionVariableException –. More...
 
class  CTlsBase
 CTlBase –. More...
 
struct  CTlsBase::STlsData
 Internal structure to store all three pointers in the same TLS. More...
 
class  CTls< TValue >
 CTls –. More...
 
class  CSimpleStaticTls< V >
 CSimpleStaticTls. More...
 
struct  CSimpleStaticTls< V >::SCaster< A >
 
struct  CSimpleStaticTls< V >::SCaster< A * >
 
class  CStaticTls_Callbacks< TValue >
 
class  CStaticTls< TValue >
 
class  CUsedTlsBases
 
class  CThread
 CThread –. More...
 
class  CThreadException
 
class  CLockVector< BV >
 Class implements bit-vector based lock storage registering millions of int numbered objects. More...
 
class  CLockVectorGuard< TLockVect >
 Lock guard for the CLockVector. More...
 

Macros

#define NCBI_SCHED_YIELD()   ::SwitchToThread()
 
#define NCBI_SCHED_SPIN_INIT()   int spin_counter = 0
 
#define NCBI_SCHED_SPIN_YIELD()   if ( !(++spin_counter & 3) ) ::SwitchToThread()
 
#define NCBI_COUNTER_ASM_OK   1
 
#define NCBI_ATOMIC_TYPE(t)   std::atomic<t>
 
#define NCBI_COUNTER_UNSIGNED   1
 
#define NCBI_COUNTER_USE_STD_ATOMIC   1
 
#define NCBI_COUNTER_ADD(p, d)   ((*p) += d)
 
#define NCBI_SWAP_POINTERS(loc, nv)   (InterlockedExchangePointer(loc, nv))
 
#define INTERNAL_MUTEX_DEBUG
 Mutex debug setting. More...
 
#define SYSTEM_MUTEX_INITIALIZER   PTHREAD_MUTEX_INITIALIZER
 
#define NCBI_NAMESPACE_MUTEX   ncbi_namespace_mutex_mt
 
#define THREAD_SYSTEM_ID_INITIALIZER   0
 Use in defining initial value of system mutex. More...
 
#define STATIC_FAST_MUTEX_INITIALIZER    { SYSTEM_MUTEX_INITIALIZER, NCBI_NS_NCBI::SSystemFastMutex::eMutexInitialized }
 Determine type of system mutex initialization. More...
 
#define DEFINE_STATIC_FAST_MUTEX(id)   static NCBI_NS_NCBI::SSystemFastMutex id = STATIC_FAST_MUTEX_INITIALIZER
 Define static fast mutex and initialize it. More...
 
#define DECLARE_CLASS_STATIC_FAST_MUTEX(id)   static NCBI_NS_NCBI::SSystemFastMutex id
 Declare static fast mutex. More...
 
#define DEFINE_CLASS_STATIC_FAST_MUTEX(id)   NCBI_NS_NCBI::SSystemFastMutex id = STATIC_FAST_MUTEX_INITIALIZER
 Define fast mutex and initialize it. More...
 
#define STATIC_MUTEX_INITIALIZER    { STATIC_FAST_MUTEX_INITIALIZER, THREAD_SYSTEM_ID_INITIALIZER, 0 }
 Define static mutex initializer. More...
 
#define DEFINE_STATIC_MUTEX(id)   static NCBI_NS_NCBI::SSystemMutex id = STATIC_MUTEX_INITIALIZER
 Define static mutex and initialize it. More...
 
#define DECLARE_CLASS_STATIC_MUTEX(id)   static NCBI_NS_NCBI::SSystemMutex id
 Declare static mutex. More...
 
#define DEFINE_CLASS_STATIC_MUTEX(id)   NCBI_NS_NCBI::SSystemMutex id = STATIC_MUTEX_INITIALIZER
 Define mutex and initialize it. More...
 
#define NCBI_HAVE_CONDITIONAL_VARIABLE
 CConditionVariable –. More...
 
#define DECLARE_TLS_VAR(type, var)   CSimpleStaticTls<type> var
 
#define NCBI_STATIC_TLS_VIA_SAFE_STATIC_REF   1
 

Typedefs

typedef size_t TNCBIAtomicValue
 Define platform specific atomic-operations macros/values. More...
 
typedef pthread_mutex_t TSystemMutex
 Define a platform independent system mutex. More...
 
typedef TThreadSystemID CThreadSystemID::TID
 Define a simpler alias for TThreadSystemID. More...
 
typedef CGuard< SSystemFastMutex > TFastMutexGuard
 typedefs for ease of use More...
 
typedef TFastMutexGuard CFastMutexGuard
 ...and backward compatibility More...
 
typedef CGuard< SSystemMutex > TMutexGuard
 typedefs for ease of use More...
 
typedef TMutexGuard CMutexGuard
 ...and backward compatibility More...
 
typedef CFastMutexGuard CFastMutex::TReadLockGuard
 Define Read Lock Guard. More...
 
typedef CFastMutexGuard CFastMutex::TWriteLockGuard
 Define Write Lock Guard. More...
 
typedef CMutexGuard CMutex::TReadLockGuard
 Define Read Lock Guard. More...
 
typedef CMutexGuard CMutex::TWriteLockGuard
 Define Write Lock Guard. More...
 
typedef CNoLock CNoMutex
 CNoMutex –. More...
 
typedef CGuard< CSpinLockCSpinGuard
 
typedef CSpinGuard CSpinLock::TReadLockGuard
 Define Read Lock Guard. More...
 
typedef CSpinGuard CSpinLock::TWriteLockGuard
 Define Write Lock Guard. More...
 
typedef CGuard< CRWLock, SSimpleReadLock< CRWLock > > TReadLockGuard
 
typedef TReadLockGuard CReadLockGuard
 
typedef CGuard< CRWLock, SSimpleWriteLock< CRWLock > > TWriteLockGuard
 
typedef TWriteLockGuard CWriteLockGuard
 
typedef int CRWLock::TFlags
 binary OR of EFlags More...
 
typedef CReadLockGuard CRWLock::TReadLockGuard
 Define Read Lock Guard. More...
 
typedef CWriteLockGuard CRWLock::TWriteLockGuard
 Define Write Lock Guard. More...
 
typedef CGuard< CFastRWLock, SSimpleReadLock< CFastRWLock >, SSimpleReadUnlock< CFastRWLock > > CFastReadGuard
 
typedef CGuard< CFastRWLock, SSimpleWriteLock< CFastRWLock >, SSimpleWriteUnlock< CFastRWLock > > CFastWriteGuard
 
typedef CFastReadGuard CFastRWLock::TReadLockGuard
 
typedef CFastWriteGuard CFastRWLock::TWriteLockGuard
 
typedef CIRef< IRWLockHolder_ListenerTRWLockHolder_ListenerRef
 Types of smart references to IRWLockHolder_Listener. More...
 
typedef CWeakIRef< IRWLockHolder_ListenerTRWLockHolder_ListenerWeakRef
 
typedef list< TRWLockHolder_ListenerWeakRefCRWLockHolder::TListenersList
 
typedef CRef< CRWLockHolderTRWLockHolderRef
 Type that should be always used to store pointers to CRWLockHolder. More...
 
typedef deque< TRWLockHolderRefCYieldingRWLock::THoldersList
 
typedef void(* CTlsBase::FCleanupBase) (void *value, void *cleanup_data)
 
typedef void(* CTls< TValue >::FCleanup) (TValue *value, void *cleanup_data)
 Define cleanup function type, FCleanup. More...
 
typedef pthread_key_t CSimpleStaticTls< V >::key_type
 
typedef V CSimpleStaticTls< V >::value_type
 
typedef void(* CStaticTls_Callbacks< TValue >::FUserCleanup) (void *ptr)
 
typedef CSafeStatic< CTls< TValue >, CStaticTls_Callbacks< TValue > > CStaticTls< TValue >::TParent
 
typedef CSafeStaticLifeSpan CStaticTls< TValue >::TLifeSpan
 
typedef void(* CStaticTls< TValue >::FUserCleanup) (void *ptr)
 User cleanup function type. More...
 
typedef void(* CStaticTls< TValue >::FCleanup) (TValue *value, void *cleanup_data)
 Define cleanup function type, FCleanup. More...
 
typedef set< CTlsBase * > CUsedTlsBases::TTlsSet
 
typedef int CThread::TRunMode
 Bitwise OR'd flags for thread creation passed to Run(). More...
 
typedef unsigned int CThread::TID
 Get ID of current thread. More...
 
typedef pthread_key_t TTlsKey
 Define internal TLS key type. More...
 
typedef pthread_t TThreadHandle
 Define platform-dependent thread handle type. More...
 
typedef pthread_t TThreadSystemID
 Define platform-dependent thread ID type. More...
 
typedef void * TWrapperRes
 Define platform-dependent result wrapper. More...
 
typedef void * TWrapperArg
 Define platform-dependent argument wrapper. More...
 
typedef BV CLockVector< BV >::TBitVector
 
typedef TLockVect CLockVectorGuard< TLockVect >::TLockVector
 

Enumerations

enum  CMutexException::EErrCode {
  CMutexException::eLock , CMutexException::eUnlock , CMutexException::eTryLock , CMutexException::eOwner ,
  CMutexException::eUninitialized
}
 Error types that a mutex can generate. More...
 
enum  ncbi_namespace_mutex_mt::SSystemFastMutex::EMagic { ncbi_namespace_mutex_mt::SSystemFastMutex::eMutexUninitialized = 0 , ncbi_namespace_mutex_mt::SSystemFastMutex::eMutexInitialized = 0x2487adab }
 Initialization flag values. More...
 
enum  ncbi_namespace_mutex_mt::SSystemFastMutex::ELockSemantics { ncbi_namespace_mutex_mt::SSystemFastMutex::eNormal , ncbi_namespace_mutex_mt::SSystemFastMutex::ePseudo }
 This is for condition variables. More...
 
enum  CRWLock::EFlags { CRWLock::fFavorWriters = 0x1 }
 Flags (passed at construction time) for fine-tuning lock behavior. More...
 
enum  CRWLock::EInternalFlags { CRWLock::fTrackReaders = 0x40000000 }
 
enum  { CFastRWLock::kWriteLockValue = 0x100000 }
 
enum  ERWLockType { eReadLock = 0 , eWriteLock = 1 }
 Type of locking provided by CYieldingRWLock. More...
 
enum  CConditionVariableException::EErrCode {
  CConditionVariableException::eInvalidValue , CConditionVariableException::eMutexLockCount , CConditionVariableException::eMutexOwner , CConditionVariableException::eMutexDifferent ,
  CConditionVariableException::eUnsupported
}
 Error types that a condition variable can generate. More...
 
enum  CTlsBase::ENativeThreadCleanup { CTlsBase::eDoCleanup , CTlsBase::eSkipCleanup }
 Flag indicating if cleanup function should be called when using native threads rather than CThread. More...
 
enum  CTlsBase::ECleanupMode { CTlsBase::eCleanup_Toolkit , CTlsBase::eCleanup_Native }
 Flag telling which code has called TLS cleanup. More...
 
enum  CThread::ERunMode {
  CThread::fRunDefault = 0x00 , CThread::fRunDetached = 0x01 , CThread::fRunBound = 0x10 , CThread::fRunUnbound = 0x20 ,
  CThread::fRunNice = 0x40 , CThread::fRunAllowST = 0x100 , CThread::fRunCloneRequestContext = 0x200
}
 Which mode should the thread run in. More...
 
enum  CThreadException::EErrCode { CThreadException::eRunError , CThreadException::eControlError , CThreadException::eOther }
 

Functions

void * NCBI_SwapPointers (void *volatile *location, void *new_value)
 
static TThreadSystemID GetCurrentThreadSystemID (void)
 Get the current thread ID. More...
 
static CThreadSystemID CThreadSystemID::GetCurrent (void)
 Get the current thread ID. More...
 
bool CThreadSystemID::operator== (const CThreadSystemID &tid) const
 Equality operator for thread ID. More...
 
bool CThreadSystemID::operator!= (const CThreadSystemID &tid) const
 Non-equality operator for thread ID. More...
 
void CThreadSystemID::Set (const CThreadSystemID &tid) volatile
 volatile versions of above methods More...
 
bool CThreadSystemID::Is (const CThreadSystemID &tid) const volatile
 
bool CThreadSystemID::IsNot (const CThreadSystemID &tid) const volatile
 
virtual const char * CMutexException::GetErrCodeString (void) const override
 Translate from the error code value to its string representation. More...
 
 CMutexException::NCBI_EXCEPTION_DEFAULT (CMutexException, CCoreException)
 
void ncbi_namespace_mutex_mt::SSystemFastMutex::Lock (ELockSemantics lock=eNormal)
 Acquire mutex for the current thread with no nesting checks. More...
 
void ncbi_namespace_mutex_mt::SSystemFastMutex::Unlock (ELockSemantics lock=eNormal)
 Release mutex with no owner or nesting checks. More...
 
bool ncbi_namespace_mutex_mt::SSystemFastMutex::TryLock (void)
 Try to lock. More...
 
void ncbi_namespace_mutex_mt::SSystemFastMutex::CheckInitialized (void) const
 Check initialized value of mutex. More...
 
static NCBI_XNCBI_EXPORT void ncbi_namespace_mutex_mt::SSystemFastMutex::ThrowUninitialized (void)
 Throw uninitialized ("eUninitialized") exception. More...
 
static NCBI_XNCBI_EXPORT void ncbi_namespace_mutex_mt::SSystemFastMutex::ThrowLockFailed (void)
 Throw lock failed("eLocked") exception. More...
 
static NCBI_XNCBI_EXPORT void ncbi_namespace_mutex_mt::SSystemFastMutex::ThrowUnlockFailed (void)
 Throw unlock failed("eUnlocked") exception. More...
 
static NCBI_XNCBI_EXPORT void ncbi_namespace_mutex_mt::SSystemFastMutex::ThrowTryLockFailed (void)
 Throw try lock failed("eTryLock") exception. More...
 
bool ncbi_namespace_mutex_mt::SSystemFastMutex::IsInitialized (void) const
 Check if mutex is initialized. More...
 
bool ncbi_namespace_mutex_mt::SSystemFastMutex::IsUninitialized (void) const
 Check if mutex is un-initialized. More...
 
void ncbi_namespace_mutex_mt::SSystemFastMutex::InitializeStatic (void)
 Initialize static mutex. More...
 
void ncbi_namespace_mutex_mt::SSystemFastMutex::InitializeDynamic (void)
 Initialize dynamic mutex. More...
 
void ncbi_namespace_mutex_mt::SSystemFastMutex::Destroy (void)
 Destroy mutex. More...
 
void ncbi_namespace_mutex_mt::SSystemFastMutex::InitializeHandle (void)
 Initialize mutex handle. More...
 
void ncbi_namespace_mutex_mt::SSystemFastMutex::DestroyHandle (void)
 Destroy mutex handle. More...
 
void ncbi_namespace_mutex_mt::SSystemMutex::Lock (SSystemFastMutex::ELockSemantics lock=SSystemFastMutex::eNormal)
 Acquire mutex for the current thread. More...
 
void ncbi_namespace_mutex_mt::SSystemMutex::Unlock (SSystemFastMutex::ELockSemantics lock=SSystemFastMutex::eNormal)
 Release mutex. More...
 
bool ncbi_namespace_mutex_mt::SSystemMutex::TryLock (void)
 Try to lock. More...
 
static NCBI_XNCBI_EXPORT void ncbi_namespace_mutex_mt::SSystemMutex::ThrowNotOwned (void)
 Throw not owned("eOwner") exception. More...
 
bool ncbi_namespace_mutex_mt::SSystemMutex::IsInitialized (void) const
 Check if mutex is initialized. More...
 
bool ncbi_namespace_mutex_mt::SSystemMutex::IsUninitialized (void) const
 Check if mutex is un-initialized. More...
 
void ncbi_namespace_mutex_mt::SSystemMutex::InitializeStatic (void)
 Initialize static mutex. More...
 
void ncbi_namespace_mutex_mt::SSystemMutex::InitializeDynamic (void)
 Initialize dynamic mutex. More...
 
void ncbi_namespace_mutex_mt::SSystemMutex::Destroy (void)
 Destroy mutex. More...
 
 CFastMutex::CFastMutex (void)
 Constructor. More...
 
 CFastMutex::~CFastMutex (void)
 Destructor. More...
 
void CFastMutex::Lock (void)
 Acquire mutex for the current thread with no nesting checks. More...
 
void CFastMutex::Unlock (void)
 Release mutex with no owner or nesting checks. More...
 
bool CFastMutex::TryLock (void)
 Try locking the mutex. More...
 
 CFastMutex::operator SSystemFastMutex & (void)
 Get SSystemFastMutex. More...
 
TSystemMutexCFastMutex::GetHandle (void)
 Get handle - Unix version. More...
 
 CFastMutex::CFastMutex (const CFastMutex &)
 Private copy constructor to disallow initialization. More...
 
CFastMutexCFastMutex::operator= (const CFastMutex &)
 Private assignment operator to disallow assignment. More...
 
 CMutex::CMutex (void)
 Constructor. More...
 
 CMutex::~CMutex (void)
 Destructor. More...
 
 CMutex::operator SSystemMutex & (void)
 Get SSystemMutex. More...
 
void CMutex::Lock (void)
 Lock mutex. More...
 
bool CMutex::TryLock (void)
 Try locking mutex. More...
 
void CMutex::Unlock (void)
 Unlock mutex. More...
 
 CMutex::CMutex (const CMutex &)
 Private copy constructor to disallow initialization. More...
 
CMutexCMutex::operator= (const CMutex &)
 Private assignment operator to disallow assignment. More...
 
 CSpinLock::CSpinLock (void)
 
 CSpinLock::~CSpinLock (void)
 
void CSpinLock::Lock (void)
 Lock the mutex. More...
 
bool CSpinLock::TryLock (void)
 Attempt to lock the mutex and return TRUE if it succeeded or FALSE if mutex is locked by other thread. More...
 
void CSpinLock::Unlock (void)
 Unlock the mutex. More...
 
bool CSpinLock::IsLocked (void) const
 Check if mutex is currently locked. More...
 
 CSpinLock::CSpinLock (const CSpinLock &)
 Prohibit copying of the object. More...
 
CSpinLockCSpinLock::operator= (const CSpinLock &)
 
void SSimpleReadLock< Class >::operator() (Class &inst) const
 
void SSimpleWriteLock< Class >::operator() (Class &inst) const
 
 CRWLock::CRWLock (TFlags flags=0)
 Constructor. More...
 
 CRWLock::~CRWLock (void)
 Destructor. More...
 
void CRWLock::ReadLock (void)
 Read lock. More...
 
void CRWLock::WriteLock (void)
 Write lock. More...
 
bool CRWLock::TryReadLock (void)
 Try read lock. More...
 
bool CRWLock::TryReadLock (const CTimeout &timeout)
 Try read lock with timeout. More...
 
bool CRWLock::TryWriteLock (void)
 Try write lock. More...
 
bool CRWLock::TryWriteLock (const CTimeout &timeout)
 Try write lock with timeout. More...
 
void CRWLock::Unlock (void)
 Release the RW-lock. More...
 
bool CRWLock::x_MayAcquireForReading (TThreadSystemID self_id)
 
 CRWLock::CRWLock (const CRWLock &)
 Private copy constructor to disallow initialization. More...
 
CRWLockCRWLock::operator= (const CRWLock &)
 Private assignment operator to disallow assignment. More...
 
void SSimpleReadUnlock< Class >::operator() (Class &inst) const
 
void SSimpleWriteUnlock< Class >::operator() (Class &inst) const
 
 CFastRWLock::CFastRWLock (void)
 
 CFastRWLock::~CFastRWLock (void)
 
void CFastRWLock::ReadLock (void)
 Acquire read lock. More...
 
void CFastRWLock::ReadUnlock (void)
 Release read lock. More...
 
void CFastRWLock::WriteLock (void)
 Acquire write lock. More...
 
void CFastRWLock::WriteUnlock (void)
 Release write lock. More...
 
 CFastRWLock::CFastRWLock (const CFastRWLock &)
 
CFastRWLockCFastRWLock::operator= (const CFastRWLock &)
 
virtual IRWLockHolder_Listener::~IRWLockHolder_Listener (void)
 
virtual void IRWLockHolder_Listener::OnLockAcquired (CRWLockHolder *holder)=0
 Callback called when lock represented by CRWLockHolder is acquired. More...
 
virtual void IRWLockHolder_Listener::OnLockReleased (CRWLockHolder *holder)=0
 Callback called when lock represented by CRWLockHolder is released. More...
 
virtual IRWLockHolder_Factory::~IRWLockHolder_Factory (void)
 
virtual CRWLockHolderIRWLockHolder_Factory::CreateHolder (CYieldingRWLock *lock, ERWLockType typ)=0
 Obtain new CRWLockHolder object for given CYieldingRWLock and necessary lock type. More...
 
virtual void IRWLockHolder_Factory::DeleteHolder (CRWLockHolder *holder)=0
 Free unnecessary (and unreferenced by anybody) CRWLockHolder object. More...
 
 CRWLockHolder::CRWLockHolder (IRWLockHolder_Factory *factory)
 Create lock holder bound to given object factory. More...
 
virtual CRWLockHolder::~CRWLockHolder (void)
 
IRWLockHolder_FactoryCRWLockHolder::GetFactory (void) const
 Get factory which this object was created from. More...
 
CYieldingRWLockCRWLockHolder::GetRWLock (void) const
 Get lock object that is locked by this holder. More...
 
ERWLockType CRWLockHolder::GetLockType (void) const
 Get type of lock held. More...
 
bool CRWLockHolder::IsLockAcquired (void) const
 Check if lock requested is already granted. More...
 
void CRWLockHolder::ReleaseLock (void)
 Release the lock held or cancel request for the lock. More...
 
void CRWLockHolder::AddListener (IRWLockHolder_Listener *listener)
 Add object keeping track of holder state changes. More...
 
void CRWLockHolder::RemoveListener (IRWLockHolder_Listener *listener)
 Remove object keeping track of holder state changes. More...
 
void CRWLockHolder::Init (CYieldingRWLock *lock, ERWLockType typ)
 Initialize holder for given CYieldingRWLock and necessary lock type. More...
 
void CRWLockHolder::Reset (void)
 Reset holder to be able to use it later (after calling Init() ) More...
 
 CRWLockHolder::CRWLockHolder (const CRWLockHolder &)
 
CRWLockHolderCRWLockHolder::operator= (const CRWLockHolder &)
 
void CRWLockHolder::x_OnLockAcquired (void)
 Callback called at the moment when lock is granted. More...
 
void CRWLockHolder::x_OnLockReleased (void)
 Callback called at the moment when lock is released. More...
 
virtual void CRWLockHolder::DeleteThis (void)
 "Delete" this holder after last reference was removed. More...
 
 CYieldingRWLock::CYieldingRWLock (IRWLockHolder_Factory *factory=NULL)
 Create read/write lock with custom holders factory. More...
 
 CYieldingRWLock::~CYieldingRWLock (void)
 It is fatal error to destroy the object while some locks are pending. More...
 
TRWLockHolderRef CYieldingRWLock::AcquireReadLock (void)
 Read lock. More...
 
TRWLockHolderRef CYieldingRWLock::AcquireWriteLock (void)
 Write lock. More...
 
TRWLockHolderRef CYieldingRWLock::AcquireLock (ERWLockType lock_type)
 General method to request read or write lock. More...
 
bool CYieldingRWLock::IsLocked (void)
 Check if any type of lock on this object is held. More...
 
void CYieldingRWLock::x_ReleaseLock (CRWLockHolder *holder)
 Main implementation releasing lock. More...
 
 CSemaphore::CSemaphore (unsigned int init_count, unsigned int max_count)
 Constructor. More...
 
 CSemaphore::~CSemaphore (void)
 Destructor. More...
 
void CSemaphore::Wait (void)
 Wait on semaphore. More...
 
bool CSemaphore::TryWait (unsigned int timeout_sec=0, unsigned int timeout_nsec=0)
 Timed wait. More...
 
bool CSemaphore::TryWait (const CTimeout &timeout)
 Timed wait. Wait time specified by CTimeout. More...
 
void CSemaphore::Post (unsigned int count=1)
 Increment the semaphore by "count". More...
 
 CSemaphore::CSemaphore (const CSemaphore &)
 Private copy constructor to disallow initialization. More...
 
CSemaphoreCSemaphore::operator= (const CSemaphore &)
 Private assignment operator to disallow assignment. More...
 
 CConditionVariable::CConditionVariable (void)
 
 CConditionVariable::~CConditionVariable (void)
 
static bool CConditionVariable::IsSupported (void)
 
bool CConditionVariable::WaitForSignal (CMutex &mutex, const CDeadline &deadline=CDeadline::eInfinite)
 Release mutex and lock the calling thread until the condition variable is signalled. More...
 
bool CConditionVariable::WaitForSignal (CFastMutex &mutex, const CDeadline &deadline=CDeadline::eInfinite)
 Release mutex and lock the calling thread until the condition variable is signalled. More...
 
void CConditionVariable::SignalSome (void)
 Wake at least one of the threads that are currently waiting on this condition variable (if any threads are waiting on it). More...
 
void CConditionVariable::SignalAll (void)
 Wake all threads that are currently waiting on the condition variable. More...
 
bool CConditionVariable::x_WaitForSignal (SSystemFastMutex &mutex, const CDeadline &timeout)
 
virtual const char * CConditionVariableException::GetErrCodeString (void) const override
 Translate from the error code value to its string representation. More...
 
 CConditionVariableException::NCBI_EXCEPTION_DEFAULT (CConditionVariableException, CCoreException)
 
 CTlsBase::CTlsBase (bool auto_destroy)
 Constructor. More...
 
 CTlsBase::~CTlsBase (void)
 Destructor. More...
 
void * CTlsBase::x_GetValue (void) const
 Helper method to get stored thread data. More...
 
void CTlsBase::x_SetValue (void *value, FCleanupBase cleanup, void *cleanup_data, ENativeThreadCleanup native)
 Helper method to set thread data. More...
 
void CTlsBase::x_Reset (void)
 Helper method to reset thread data. More...
 
void CTlsBase::x_Init (void)
 Initialize thread data. More...
 
void CTlsBase::x_Destroy (void)
 Destroy thread data. More...
 
STlsDataCTlsBase::x_GetTlsData (void) const
 Helper method to get the STlsData*. More...
 
bool CTlsBase::x_DeleteTlsData (ECleanupMode mode=eCleanup_Toolkit)
 Deletes STlsData* structure and managed pointer Returns true if CTlsBase must be deregistered from current thread. More...
 
static void CTlsBase::CleanupAndDeleteTlsData (void *data, ECleanupMode mode=eCleanup_Toolkit)
 
static void CTlsBase::CleanupTlsData (void *data, ECleanupMode mode=eCleanup_Toolkit)
 
static void CTlsBase::x_CleanupThreadCallback (void *ptr)
 
template<class TValue >
static void CTlsBase::DefaultCleanup (TValue *value, void *)
 
 CTls< TValue >::CTls (void)
 
TValue * CTls< TValue >::GetValue (void) const
 Get the pointer previously stored by SetValue(). More...
 
void CTls< TValue >::SetValue (TValue *value, FCleanup cleanup=0, void *cleanup_data=0, ENativeThreadCleanup native=eSkipCleanup)
 Set value. More...
 
void CTls< TValue >::Reset (void)
 Reset thread local storage. More...
 
void CTls< TValue >::Discard (void)
 Discard thread local storage. More...
 
static A CSimpleStaticTls< V >::SCaster< A >::FromVoidP (void *p)
 
static const void * CSimpleStaticTls< V >::SCaster< A >::ToVoidP (A v)
 
static ACSimpleStaticTls< V >::SCaster< A * >::FromVoidP (void *p)
 
static const void * CSimpleStaticTls< V >::SCaster< A * >::ToVoidP (A *v)
 
key_type CSimpleStaticTls< V >::x_GetKey (void) const
 
key_type CSimpleStaticTls< V >::x_GetKeyLong (void) const
 
 CSimpleStaticTls< V >::operator value_type () const
 Getter - returns value stored in TLS. More...
 
void CSimpleStaticTls< V >::operator= (const value_type &v)
 Setter - changes value stored in TLS. More...
 
 CStaticTls_Callbacks< TValue >::CStaticTls_Callbacks (FUserCleanup cleanup)
 
CTls< TValue > * CStaticTls_Callbacks< TValue >::Create ()
 
void CStaticTls_Callbacks< TValue >::Cleanup (CTls< TValue > &value)
 
 CStaticTls< TValue >::CStaticTls (FUserCleanup user_cleanup=0, TLifeSpan life_span=TLifeSpan::GetDefault())
 
TValue * CStaticTls< TValue >::GetValue (void)
 
void CStaticTls< TValue >::SetValue (TValue *value, FCleanup cleanup=0, void *cleanup_data=0, CTlsBase::ENativeThreadCleanup native=CTlsBase::eSkipCleanup)
 
 CUsedTlsBases::CUsedTlsBases (void)
 
 CUsedTlsBases::~CUsedTlsBases (void)
 
void CUsedTlsBases::ClearAll (CTlsBase::ECleanupMode mode=CTlsBase::eCleanup_Toolkit)
 The function is called before thread termination to cleanup data stored in the TLS. More...
 
void CUsedTlsBases::Register (CTlsBase *tls)
 
void CUsedTlsBases::Deregister (CTlsBase *tls)
 
static CUsedTlsBasesCUsedTlsBases::GetUsedTlsBases (void)
 Get the list of used TLS-es for the current thread. More...
 
static void CUsedTlsBases::ClearAllCurrentThread (CTlsBase::ECleanupMode mode=CTlsBase::eCleanup_Toolkit)
 Clear used TLS-es for the current thread. More...
 
static void CUsedTlsBases::Init (void)
 Init TLS, call before creating thread. More...
 
 CUsedTlsBases::CUsedTlsBases (const CUsedTlsBases &)
 
void CUsedTlsBases::operator= (const CUsedTlsBases &)
 
 CThread::CThread (void)
 Constructor. More...
 
bool CThread::Run (TRunMode flags=fRunDefault)
 Run the thread. More...
 
void CThread::Detach (void)
 Inform the thread that user does not need to wait for its termination. More...
 
void CThread::Join (void **exit_data=0)
 Wait for the thread termination. More...
 
static void CThread::Exit (void *exit_data)
 Cancel current thread. More...
 
bool CThread::Discard (void)
 If the thread has not been Run() yet, then schedule the thread object for destruction, and return TRUE. More...
 
bool CThread::IsTerminated (void) const
 Check if the thread has been terminated. More...
 
static TID CThread::GetSelf (void)
 
static bool CThread::IsMain (void)
 
static CThreadCThread::GetCurrentThread (void)
 Get current CThread object (or NULL, if main thread) More...
 
static void CThread::GetSystemID (TThreadSystemID *id)
 Get system ID of the current thread - for internal use only. More...
 
static unsigned int CThread::GetThreadsCount ()
 Get total amount of threads This amount does not contain main thread. More...
 
static void CThread::SetCurrentThreadName (const CTempString &)
 Set name for the current thread. More...
 
static void CThread::InitializeMainThreadId (void)
 Initialize main thread's TID. More...
 
static bool CThread::IsAppExiting (void)
 Check if the application is exiting (entered the destructor). More...
 
static void CThread::SetWaitForAllThreadsTimeout (const CTimeout &timeout)
 Set timeout for stopping all threads on application exit. More...
 
virtual void * CThread::Main (void)=0
 Derived (user-created) class must provide a real thread function. More...
 
virtual void CThread::OnExit (void)
 Override this to execute finalization code. More...
 
virtual CThread::~CThread (void)
 To be called only internally! NOTE: destructor of the derived (user-provided) class should be declared "protected", too! More...
 
TThreadHandle CThread::GetThreadHandle ()
 
void CThread::x_InitializeThreadId (void)
 initalize new thread id, must be called from Wrapper(). More...
 
static TWrapperRes CThread::Wrapper (TWrapperArg arg)
 Function to use (internally) as the thread's startup function. More...
 
static bool CThread::WaitForAllThreads (void)
 
 CThread::CThread (const CThread &)
 Prohibit copying and assigning. More...
 
CThreadCThread::operator= (const CThread &)
 
virtual const char * CThreadException::GetErrCodeString (void) const override
 Translate from the error code value to its string representation. More...
 
 CThreadException::NCBI_EXCEPTION_DEFAULT (CThreadException, CException)
 
 CLockVector< BV >::CLockVector ()
 
 CLockVector< BV >::~CLockVector ()
 
bool CLockVector< BV >::TryLock (unsigned id)
 Try to acquire lock of specified id. More...
 
bool CLockVector< BV >::Unlock (unsigned id)
 Unlock object. More...
 
bool CLockVector< BV >::IsLocked (unsigned id) const
 Check if id is locked or not. More...
 
void CLockVector< BV >::FreeUnusedMem ()
 Reclaim unused memory. More...
 
 CLockVector< BV >::CLockVector (const CLockVector< BV > &)
 
CLockVectorCLockVector< BV >::operator= (const CLockVector< BV > &)
 
 CLockVectorGuard< TLockVect >::CLockVectorGuard (TLockVector &lvect, unsigned timeout_ms)
 Construct without locking. More...
 
 CLockVectorGuard< TLockVect >::CLockVectorGuard (TLockVector &lvect, unsigned id, unsigned timeout_ms)
 Construct and lock. More...
 
 CLockVectorGuard< TLockVect >::~CLockVectorGuard ()
 
void CLockVectorGuard< TLockVect >::Lock (unsigned id)
 Acquire lock. More...
 
void CLockVectorGuard< TLockVect >::Unlock ()
 Unlocks the lock. More...
 
void CLockVectorGuard< TLockVect >::Release ()
 Forger lock. More...
 
unsigned CLockVectorGuard< TLockVect >::GetId () const
 Get BLOB id. More...
 
void CLockVectorGuard< TLockVect >::SetId (unsigned id)
 Assign Id (no locking) More...
 
void CLockVectorGuard< TLockVect >::TakeFrom (CLockVectorGuard &lg)
 Transfer lock ownership from another lock. More...
 
void CLockVectorGuard< TLockVect >::DoLock ()
 Lock acquisition. More...
 
TLockVectorCLockVectorGuard< TLockVect >::GetLockVector () const
 
unsigned CLockVectorGuard< TLockVect >::GetTimeout () const
 
 CLockVectorGuard< TLockVect >::CLockVectorGuard (const CLockVectorGuard< TLockVect > &)
 
CLockVectorGuard< TLockVect > & CLockVectorGuard< TLockVect >::operator= (const CLockVectorGuard< TLockVect > &)
 

Variables

TID CThreadSystemID::m_ID
 Thread ID. More...
 
TSystemMutex ncbi_namespace_mutex_mt::SSystemFastMutex::m_Handle
 Mutex handle. More...
 
volatile EMagic ncbi_namespace_mutex_mt::SSystemFastMutex::m_Magic
 Magic flag. More...
 
SSystemFastMutex ncbi_namespace_mutex_mt::SSystemMutex::m_Mutex
 Mutex value. More...
 
atomic< TThreadSystemIDncbi_namespace_mutex_mt::SSystemMutex::m_Owner
 Platform-dependent owner thread ID. More...
 
atomic< intncbi_namespace_mutex_mt::SSystemMutex::m_Count
 # of recursive (in the same thread) locks More...
 
SSystemFastMutex CFastMutex::m_Mutex
 Platform-dependent mutex handle, also used by CRWLock. More...
 
SSystemMutex CMutex::m_Mutex
 System mutex. More...
 
void *volatile CSpinLock::m_Value
 Flag showing if mutex is locked (non-NULL value) or unlocked (NULL value). More...
 
TFlags CRWLock::m_Flags
 Configuration flags. More...
 
unique_ptr< CInternalRWLockCRWLock::m_RW
 Platform-dependent RW-lock data. More...
 
volatile TThreadSystemID CRWLock::m_Owner
 Writer ID, one of the readers ID. More...
 
volatile long CRWLock::m_Count
 Number of readers (if >0) or writers (if <0) More...
 
volatile unsigned int CRWLock::m_WaitingWriters
 Number of writers waiting; zero if not keeping track. More...
 
vector< TThreadSystemIDCRWLock::m_Readers
 List of all readers or writers. More...
 
CAtomicCounter CFastRWLock::m_LockCount
 Number of read locks acquired or value of kWriteLockValue if write lock was acquired. More...
 
CFastMutex CFastRWLock::m_WriteLock
 Mutex implementing write lock. More...
 
IRWLockHolder_FactoryCRWLockHolder::m_Factory
 Factory created the holder. More...
 
CYieldingRWLockCRWLockHolder::m_Lock
 Lock object the holder is assigned to. More...
 
ERWLockType CRWLockHolder::m_Type
 Type of lock held. More...
 
bool CRWLockHolder::m_LockAcquired
 Flag if lock was acquired. More...
 
CSpinLock CRWLockHolder::m_ObjLock
 Mutex for operating listeners. More...
 
TListenersList CRWLockHolder::m_Listeners
 List of holder listeners. More...
 
IRWLockHolder_FactoryCYieldingRWLock::m_Factory
 Factory creating CRWLockHolder objects. More...
 
CSpinLock CYieldingRWLock::m_ObjLock
 Main locking mutex for object operations. More...
 
int CYieldingRWLock::m_Locks [2]
 Number of locks granted on this object by type. More...
 
THoldersList CYieldingRWLock::m_LockWaits
 Queue for waiting lock requests. More...
 
struct SSemaphoreCSemaphore::m_Sem
 System-specific semaphore data. More...
 
CONDITION_VARIABLE CConditionVariable::m_ConditionVar
 
CAtomicCounter_WithAutoInit CConditionVariable::m_WaitCounter
 
SSystemFastMutex *volatile CConditionVariable::m_WaitMutex
 
TTlsKey CTlsBase::m_Key
 
bool CTlsBase::m_Initialized
 Indicates if thread data initialized. More...
 
bool CTlsBase::m_AutoDestroy
 Indicates if object should be destroyed in destructor. More...
 
void * CTlsBase::STlsData::m_Value
 
FCleanupBase CTlsBase::STlsData::m_CleanupFunc
 
void * CTlsBase::STlsData::m_CleanupData
 
ENativeThreadCleanup CTlsBase::STlsData::m_Native
 
key_type CSimpleStaticTls< V >::m_Key
 
FUserCleanup CStaticTls_Callbacks< TValue >::m_Cleanup
 
TTlsSet CUsedTlsBases::m_UsedTls
 
static CStaticTls< CUsedTlsBasesCUsedTlsBases::sm_UsedTlsBases
 
TThreadHandle CThread::m_Handle
 platform-dependent thread handle More...
 
bool CThread::m_IsRun
 if Run() was called for the thread More...
 
bool CThread::m_IsDetached
 if the thread is detached More...
 
bool CThread::m_IsJoined
 if Join() was called for the thread More...
 
bool CThread::m_IsTerminated
 if Exit() was called for the thread More...
 
CRef< CThreadCThread::m_SelfRef
 "this" – to avoid premature destruction More...
 
void * CThread::m_ExitData
 as returned by Main() or passed to Exit() More...
 
CRef< CRequestContextCThread::m_ParentRequestContext
 
static bool CThread::sm_IsExiting = false
 
static CTimeout CThread::sm_WaitForThreadsTimeout = CTimeout(0.1)
 
static atomic< unsigned intCThread::sm_ThreadsCount
 Total amount of threads. More...
 
const CThread::TID kThreadID_None = 0xFFFFFFFF
 
TBitVector CLockVector< BV >::m_IdVector
 vector of locked objs More...
 
CFastMutex CLockVector< BV >::m_IdVector_Lock
 lock for m_LockVector More...
 
TLockVectorCLockVectorGuard< TLockVect >::m_LockVector
 
unsigned CLockVectorGuard< TLockVect >::m_Id
 
unsigned CLockVectorGuard< TLockVect >::m_Timeout
 
unsigned CLockVectorGuard< TLockVect >::m_Spins
 
bool CLockVectorGuard< TLockVect >::m_LockSet
 

Friends

struct ncbi_namespace_mutex_mt::SSystemFastMutex::SSystemMutex
 
class ncbi_namespace_mutex_mt::SSystemFastMutex::::ncbi::CAutoInitializeStaticFastMutex
 
class ncbi_namespace_mutex_mt::SSystemFastMutex::::ncbi::CFastMutex
 
class ncbi_namespace_mutex_mt::SSystemFastMutex::::ncbi::CSafeStaticPtr_Base
 
class ncbi_namespace_mutex_mt::SSystemMutex::::ncbi::CAutoInitializeStaticMutex
 
class ncbi_namespace_mutex_mt::SSystemMutex::::ncbi::CMutex
 
class CFastMutex::CRWLock
 
class CMutex::CRWLock
 Allow use of m_Mtx and m_Owner members directly. More...
 
class CRWLockHolder::CYieldingRWLock
 
class CYieldingRWLock::CRWLockHolder
 
class CTlsBase::CRef< CTlsBase >
 
class CTlsBase::CUsedTlsBases
 
class CTlsBase::CStaticTlsHelper
 
class CStaticTls< TValue >::CUsedTlsBases
 
class CThread::CRef< CThread >
 
class CThread::CTlsBase
 
class CThread::CNcbiApplicationAPI
 
TWrapperRes CThread::ThreadWrapperCaller (TWrapperArg arg)
 

Detailed Description

Macro Definition Documentation

◆ DECLARE_CLASS_STATIC_FAST_MUTEX

#define DECLARE_CLASS_STATIC_FAST_MUTEX (   id)    static NCBI_NS_NCBI::SSystemFastMutex id

Declare static fast mutex.

Definition at line 500 of file ncbimtx.hpp.

◆ DECLARE_CLASS_STATIC_MUTEX

#define DECLARE_CLASS_STATIC_MUTEX (   id)    static NCBI_NS_NCBI::SSystemMutex id

Declare static mutex.

Definition at line 516 of file ncbimtx.hpp.

◆ DECLARE_TLS_VAR

#define DECLARE_TLS_VAR (   type,
  var 
)    CSimpleStaticTls<type> var

Definition at line 288 of file ncbithr.hpp.

◆ DEFINE_CLASS_STATIC_FAST_MUTEX

#define DEFINE_CLASS_STATIC_FAST_MUTEX (   id)    NCBI_NS_NCBI::SSystemFastMutex id = STATIC_FAST_MUTEX_INITIALIZER

Define fast mutex and initialize it.

Definition at line 504 of file ncbimtx.hpp.

◆ DEFINE_CLASS_STATIC_MUTEX

#define DEFINE_CLASS_STATIC_MUTEX (   id)    NCBI_NS_NCBI::SSystemMutex id = STATIC_MUTEX_INITIALIZER

Define mutex and initialize it.

Definition at line 520 of file ncbimtx.hpp.

◆ DEFINE_STATIC_FAST_MUTEX

#define DEFINE_STATIC_FAST_MUTEX (   id)    static NCBI_NS_NCBI::SSystemFastMutex id = STATIC_FAST_MUTEX_INITIALIZER

Define static fast mutex and initialize it.

Definition at line 496 of file ncbimtx.hpp.

◆ DEFINE_STATIC_MUTEX

#define DEFINE_STATIC_MUTEX (   id)    static NCBI_NS_NCBI::SSystemMutex id = STATIC_MUTEX_INITIALIZER

Define static mutex and initialize it.

Definition at line 512 of file ncbimtx.hpp.

◆ INTERNAL_MUTEX_DEBUG

#define INTERNAL_MUTEX_DEBUG

Mutex debug setting.

Definition at line 93 of file ncbimtx.hpp.

◆ NCBI_ATOMIC_TYPE

#define NCBI_ATOMIC_TYPE (   t)    std::atomic<t>

Definition at line 143 of file ncbi_atomic_defs.h.

◆ NCBI_COUNTER_ADD

#define NCBI_COUNTER_ADD (   p,
 
)    ((*p) += d)

Definition at line 146 of file ncbi_atomic_defs.h.

◆ NCBI_COUNTER_ASM_OK

#define NCBI_COUNTER_ASM_OK   1

Definition at line 85 of file ncbi_atomic_defs.h.

◆ NCBI_COUNTER_UNSIGNED

#define NCBI_COUNTER_UNSIGNED   1

Definition at line 144 of file ncbi_atomic_defs.h.

◆ NCBI_COUNTER_USE_STD_ATOMIC

#define NCBI_COUNTER_USE_STD_ATOMIC   1

Definition at line 145 of file ncbi_atomic_defs.h.

◆ NCBI_HAVE_CONDITIONAL_VARIABLE

#define NCBI_HAVE_CONDITIONAL_VARIABLE

CConditionVariable –.

Condition variable.

Definition at line 1437 of file ncbimtx.hpp.

◆ NCBI_NAMESPACE_MUTEX

#define NCBI_NAMESPACE_MUTEX   ncbi_namespace_mutex_mt

Definition at line 147 of file ncbimtx.hpp.

◆ NCBI_SCHED_SPIN_INIT

#define NCBI_SCHED_SPIN_INIT ( )    int spin_counter = 0

Definition at line 57 of file ncbi_atomic_defs.h.

◆ NCBI_SCHED_SPIN_YIELD

#define NCBI_SCHED_SPIN_YIELD ( )    if ( !(++spin_counter & 3) ) ::SwitchToThread()

Definition at line 58 of file ncbi_atomic_defs.h.

◆ NCBI_SCHED_YIELD

#define NCBI_SCHED_YIELD ( )    ::SwitchToThread()

Definition at line 56 of file ncbi_atomic_defs.h.

◆ NCBI_STATIC_TLS_VIA_SAFE_STATIC_REF

#define NCBI_STATIC_TLS_VIA_SAFE_STATIC_REF   1

Definition at line 292 of file ncbithr.hpp.

◆ NCBI_SWAP_POINTERS

#define NCBI_SWAP_POINTERS (   loc,
  nv 
)    (InterlockedExchangePointer(loc, nv))

Definition at line 268 of file ncbi_atomic_defs.h.

◆ STATIC_FAST_MUTEX_INITIALIZER

#define STATIC_FAST_MUTEX_INITIALIZER    { SYSTEM_MUTEX_INITIALIZER, NCBI_NS_NCBI::SSystemFastMutex::eMutexInitialized }

Determine type of system mutex initialization.

Define static fast mutex initial value.

Definition at line 492 of file ncbimtx.hpp.

◆ STATIC_MUTEX_INITIALIZER

#define STATIC_MUTEX_INITIALIZER    { STATIC_FAST_MUTEX_INITIALIZER, THREAD_SYSTEM_ID_INITIALIZER, 0 }

Define static mutex initializer.

Definition at line 508 of file ncbimtx.hpp.

◆ SYSTEM_MUTEX_INITIALIZER

#define SYSTEM_MUTEX_INITIALIZER   PTHREAD_MUTEX_INITIALIZER

Definition at line 120 of file ncbimtx.hpp.

◆ THREAD_SYSTEM_ID_INITIALIZER

#define THREAD_SYSTEM_ID_INITIALIZER   0

Use in defining initial value of system mutex.

Definition at line 164 of file ncbimtx.hpp.

Typedef Documentation

◆ CFastMutexGuard

...and backward compatibility

Definition at line 391 of file ncbimtx.hpp.

◆ CFastReadGuard

Definition at line 1080 of file ncbimtx.hpp.

◆ CFastWriteGuard

Definition at line 1099 of file ncbimtx.hpp.

◆ CMutexGuard

...and backward compatibility

Definition at line 485 of file ncbimtx.hpp.

◆ CNoMutex

typedef CNoLock CNoMutex

CNoMutex –.

Fake mutex that does not lock anything.

Allows to create template classes which use CMutex/CFastMutex/CNoMutex as an argument. In case of CNoMutex no real locking is performed.

See also
CNoLock

Definition at line 824 of file ncbimtx.hpp.

◆ CReadLockGuard

Definition at line 917 of file ncbimtx.hpp.

◆ CSpinGuard

Definition at line 828 of file ncbimtx.hpp.

◆ CWriteLockGuard

Definition at line 935 of file ncbimtx.hpp.

◆ FCleanup [1/2]

template<class TValue >
typedef void(* CTls< TValue >::FCleanup) (TValue *value, void *cleanup_data)

Define cleanup function type, FCleanup.

Definition at line 185 of file ncbithr.hpp.

◆ FCleanup [2/2]

template<class TValue >
typedef void(* CStaticTls< TValue >::FCleanup) (TValue *value, void *cleanup_data)

Define cleanup function type, FCleanup.

Definition at line 327 of file ncbithr.hpp.

◆ FCleanupBase

typedef void(* CTlsBase::FCleanupBase) (void *value, void *cleanup_data)

Definition at line 72 of file ncbithr.hpp.

◆ FUserCleanup [1/2]

template<class TValue >
typedef void(* CStaticTls_Callbacks< TValue >::FUserCleanup) (void *ptr)

Definition at line 300 of file ncbithr.hpp.

◆ FUserCleanup [2/2]

template<class TValue >
typedef void(* CStaticTls< TValue >::FUserCleanup) (void *ptr)

User cleanup function type.

Definition at line 325 of file ncbithr.hpp.

◆ key_type

template<class V >
typedef pthread_key_t CSimpleStaticTls< V >::key_type
private

Definition at line 242 of file ncbithr.hpp.

◆ TBitVector

template<class BV >
typedef BV CLockVector< BV >::TBitVector

Definition at line 60 of file lock_vector.hpp.

◆ TFastMutexGuard

typedef CGuard<SSystemFastMutex> TFastMutexGuard

typedefs for ease of use

Definition at line 388 of file ncbimtx.hpp.

◆ TFlags

binary OR of EFlags

Definition at line 961 of file ncbimtx.hpp.

◆ THoldersList

Definition at line 1350 of file ncbimtx.hpp.

◆ TID [1/2]

Define a simpler alias for TThreadSystemID.

Definition at line 180 of file ncbimtx.hpp.

◆ TID [2/2]

typedef unsigned int CThread::TID

Get ID of current thread.

When not using native threads, but CThread only, the main thread is guaranteed to have zero id. With native threads the main thread may have a non-zero id and it's more reliable to use IsMain().

Definition at line 598 of file ncbithr.hpp.

◆ TLifeSpan

template<class TValue >
typedef CSafeStaticLifeSpan CStaticTls< TValue >::TLifeSpan

Definition at line 323 of file ncbithr.hpp.

◆ TListenersList

Definition at line 1283 of file ncbimtx.hpp.

◆ TLockVector

template<class TLockVect >
typedef TLockVect CLockVectorGuard< TLockVect >::TLockVector

Definition at line 101 of file lock_vector.hpp.

◆ TMutexGuard

typedef CGuard<SSystemMutex> TMutexGuard

typedefs for ease of use

Definition at line 482 of file ncbimtx.hpp.

◆ TNCBIAtomicValue

typedef size_t TNCBIAtomicValue

Define platform specific atomic-operations macros/values.

TNCBIAtomicValue "type" is defined based on facilities available for a compiler/platform. TNCBIAtomicValue is used in the CAtomicCounter class for defining the internal represntation of the counter.

Where possible NCBI_COUNTER_ADD is defined in terms of compiler/platform specific features, favoring inline assembly over standard library calls as function-call overhead can be appreciable, particularly on x86.

Definition at line 139 of file ncbi_atomic_defs.h.

◆ TParent

template<class TValue >
typedef CSafeStatic<CTls<TValue>, CStaticTls_Callbacks<TValue> > CStaticTls< TValue >::TParent
private

Definition at line 320 of file ncbithr.hpp.

◆ TReadLockGuard [1/6]

Define Read Lock Guard.

Definition at line 680 of file ncbimtx.hpp.

◆ TReadLockGuard [2/6]

Define Read Lock Guard.

Definition at line 760 of file ncbimtx.hpp.

◆ TReadLockGuard [3/6]

Define Read Lock Guard.

Definition at line 849 of file ncbimtx.hpp.

◆ TReadLockGuard [4/6]

Definition at line 916 of file ncbimtx.hpp.

◆ TReadLockGuard [5/6]

Define Read Lock Guard.

Definition at line 970 of file ncbimtx.hpp.

◆ TReadLockGuard [6/6]

Definition at line 1137 of file ncbimtx.hpp.

◆ TRunMode

Bitwise OR'd flags for thread creation passed to Run().

Definition at line 558 of file ncbithr.hpp.

◆ TRWLockHolder_ListenerRef

Types of smart references to IRWLockHolder_Listener.

Definition at line 1202 of file ncbimtx.hpp.

◆ TRWLockHolder_ListenerWeakRef

Definition at line 1203 of file ncbimtx.hpp.

◆ TRWLockHolderRef

Type that should be always used to store pointers to CRWLockHolder.

Definition at line 1300 of file ncbimtx.hpp.

◆ TSystemMutex

typedef pthread_mutex_t TSystemMutex

Define a platform independent system mutex.

Definition at line 119 of file ncbimtx.hpp.

◆ TThreadHandle

typedef pthread_t TThreadHandle

Define platform-dependent thread handle type.

Definition at line 92 of file ncbithr_conf.hpp.

◆ TThreadSystemID

typedef pthread_t TThreadSystemID

Define platform-dependent thread ID type.

Definition at line 95 of file ncbithr_conf.hpp.

◆ TTlsKey

typedef pthread_key_t TTlsKey

Define internal TLS key type.

Definition at line 89 of file ncbithr_conf.hpp.

◆ TTlsSet

typedef set<CTlsBase*> CUsedTlsBases::TTlsSet
private

Definition at line 506 of file ncbithr.hpp.

◆ TWrapperArg

typedef void* TWrapperArg

Define platform-dependent argument wrapper.

Definition at line 101 of file ncbithr_conf.hpp.

◆ TWrapperRes

typedef void* TWrapperRes

Define platform-dependent result wrapper.

Definition at line 98 of file ncbithr_conf.hpp.

◆ TWriteLockGuard [1/6]

Define Write Lock Guard.

Definition at line 683 of file ncbimtx.hpp.

◆ TWriteLockGuard [2/6]

Define Write Lock Guard.

Definition at line 763 of file ncbimtx.hpp.

◆ TWriteLockGuard [3/6]

Define Write Lock Guard.

Definition at line 851 of file ncbimtx.hpp.

◆ TWriteLockGuard [4/6]

Definition at line 934 of file ncbimtx.hpp.

◆ TWriteLockGuard [5/6]

Define Write Lock Guard.

Definition at line 973 of file ncbimtx.hpp.

◆ TWriteLockGuard [6/6]

Definition at line 1138 of file ncbimtx.hpp.

◆ value_type

template<class V >
typedef V CSimpleStaticTls< V >::value_type

Definition at line 278 of file ncbithr.hpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
kWriteLockValue 

Number in lock count showing that write lock is acquired.

Definition at line 1157 of file ncbimtx.hpp.

◆ ECleanupMode

Flag telling which code has called TLS cleanup.

Enumerator
eCleanup_Toolkit 

Cleanup is performed by CThread.

eCleanup_Native 

Cleanup is performed by thread_local destructor.

Definition at line 84 of file ncbithr.hpp.

◆ EErrCode [1/3]

Error types that a mutex can generate.

Enumerator
eLock 

Lock error.

eUnlock 

Unlock error.

eTryLock 

Attempted lock error.

eOwner 

Not owned error.

eUninitialized 

Uninitialized error.

Definition at line 233 of file ncbimtx.hpp.

◆ EErrCode [2/3]

Error types that a condition variable can generate.

Enumerator
eInvalidValue 

Parameter of WaitForSignal function is invalid.

Mutex passed to WaitForSignal is not locked exactly once

eMutexLockCount 

Mutex passed to WaitForSignal is not owned by the current thread.

eMutexOwner 

Different mutexes were supplied for concurrent WaitForSignal operations on this condition variable.

eMutexDifferent 

Condition variable is not supported on this platform.

eUnsupported 

Definition at line 1528 of file ncbimtx.hpp.

◆ EErrCode [3/3]

Enumerator
eRunError 

Failed to run thread.

eControlError 

Failed to control thread's state.

eOther 

Other thread errors.

Definition at line 695 of file ncbithr.hpp.

◆ EFlags

Flags (passed at construction time) for fine-tuning lock behavior.

Enumerator
fFavorWriters 

Forbid further readers from acquiring the lock if any writers are waiting for it, to keep would-be writers from starving.

Definition at line 956 of file ncbimtx.hpp.

◆ EInternalFlags

Enumerator
fTrackReaders 

Keep track of which threads have read locks.

Definition at line 1039 of file ncbimtx.hpp.

◆ ELockSemantics

This is for condition variables.

Enumerator
eNormal 
ePseudo 

Modify object data and call system.

Modify object data, but do not call system

Definition at line 287 of file ncbimtx.hpp.

◆ EMagic

Initialization flag values.

Enumerator
eMutexUninitialized 

Uninitialized value.

eMutexInitialized 

Magic initialized value,.

Definition at line 280 of file ncbimtx.hpp.

◆ ENativeThreadCleanup

Flag indicating if cleanup function should be called when using native threads rather than CThread.

Native threads may perform cleanup later than CThread, so that some resources (like static variables) may be already destroyed. To prevent failures the default mode is eSkipCleanup.

Enumerator
eDoCleanup 
eSkipCleanup 

Definition at line 78 of file ncbithr.hpp.

◆ ERunMode

Which mode should the thread run in.

Enumerator
fRunDefault 

Default mode.

fRunDetached 

Run the thread detached (non-joinable)

fRunBound 

Run thread in a 1:1 thread:LPW mode.

  • may not be supported and will be ignored on some platforms
fRunUnbound 

Run thread in a N:1 thread:LPW mode.

  • may not be supported and will be ignored on some platforms
fRunNice 

Run thread with low priority (MS-Win only)

fRunAllowST 

Allow threads to run in single thread builds.

fRunCloneRequestContext 

Clone parent's request context and pass it to the new thread.

The flag can be used when processing the same request in multiple child threads.

Definition at line 539 of file ncbithr.hpp.

◆ ERWLockType

Type of locking provided by CYieldingRWLock.

Enumerator
eReadLock 
eWriteLock 

Definition at line 1179 of file ncbimtx.hpp.

Function Documentation

◆ AcquireLock()

TRWLockHolderRef CYieldingRWLock::AcquireLock ( ERWLockType  lock_type)

◆ AcquireReadLock()

TRWLockHolderRef CYieldingRWLock::AcquireReadLock ( void  )

Read lock.

Method returns immediately no matter if lock is granted or not. If lock is not granted then request for lock is remembered and will be granted later unless CRWLockHolder::ReleaseLock() is called (or object is deleted).

◆ AcquireWriteLock()

TRWLockHolderRef CYieldingRWLock::AcquireWriteLock ( void  )

Write lock.

Method returns immediately no matter if lock is granted or not. If lock is not granted then request for lock is remembered and will be granted later unless CRWLockHolder::ReleaseLock() is called (or object is deleted).

◆ AddListener()

void CRWLockHolder::AddListener ( IRWLockHolder_Listener listener)

Add object keeping track of holder state changes.

◆ CConditionVariable()

CConditionVariable::CConditionVariable ( void  )

Definition at line 2364 of file ncbimtx.cpp.

References NCBI_THROW, and NULL.

◆ CFastMutex() [1/2]

CFastMutex::CFastMutex ( const CFastMutex )
private

Private copy constructor to disallow initialization.

◆ CFastMutex() [2/2]

CFastMutex::CFastMutex ( void  )

Constructor.

Creates mutex handle.

◆ CFastRWLock() [1/2]

CFastRWLock::CFastRWLock ( const CFastRWLock )
private

◆ CFastRWLock() [2/2]

CFastRWLock::CFastRWLock ( void  )

◆ CheckInitialized()

void ncbi_namespace_mutex_mt::SSystemFastMutex::CheckInitialized ( void  ) const

Check initialized value of mutex.

◆ Cleanup()

template<class TValue >
void CStaticTls_Callbacks< TValue >::Cleanup ( CTls< TValue > &  value)
inline

◆ CleanupAndDeleteTlsData()

void CTlsBase::CleanupAndDeleteTlsData ( void *  data,
ECleanupMode  mode = eCleanup_Toolkit 
)
staticprivate

Definition at line 201 of file ncbithr.cpp.

References CTlsBase::CleanupTlsData(), and data.

Referenced by CTlsBase::x_CleanupThreadCallback(), and CTlsBase::x_DeleteTlsData().

◆ CleanupTlsData()

void CTlsBase::CleanupTlsData ( void *  data,
ECleanupMode  mode = eCleanup_Toolkit 
)
staticprivate

◆ ClearAll()

void CUsedTlsBases::ClearAll ( CTlsBase::ECleanupMode  mode = CTlsBase::eCleanup_Toolkit)

◆ ClearAllCurrentThread()

void CUsedTlsBases::ClearAllCurrentThread ( CTlsBase::ECleanupMode  mode = CTlsBase::eCleanup_Toolkit)
static

Clear used TLS-es for the current thread.

Definition at line 174 of file ncbithr.cpp.

References CStaticTls< TValue >::GetValue(), and CUsedTlsBases::sm_UsedTlsBases.

Referenced by CThread::Wrapper(), and SNativeThreadTlsCleanup::~SNativeThreadTlsCleanup().

◆ CLockVector() [1/2]

template<class BV >
CLockVector< BV >::CLockVector

Definition at line 281 of file lock_vector.hpp.

◆ CLockVector() [2/2]

template<class BV >
CLockVector< BV >::CLockVector ( const CLockVector< BV > &  )
private

◆ CLockVectorGuard() [1/3]

template<class TLockVect >
CLockVectorGuard< TLockVect >::CLockVectorGuard ( const CLockVectorGuard< TLockVect > &  )
private

◆ CLockVectorGuard() [2/3]

template<class TLockVect >
CLockVectorGuard< TLockVect >::CLockVectorGuard ( TLockVector lvect,
unsigned  id,
unsigned  timeout_ms 
)

Construct and lock.

Parameters
lvectLock vector storing all locks
idObject Id we are locking
timeout_msTimeout in milliseconds for how long lock makes attempts to acquire the id. If cannot lock it throws an exception.

Definition at line 182 of file lock_vector.hpp.

References _ASSERT, and CLockVectorGuard< TLockVect >::DoLock().

◆ CLockVectorGuard() [3/3]

template<class TLockVect >
CLockVectorGuard< TLockVect >::CLockVectorGuard ( TLockVector lvect,
unsigned  timeout_ms 
)

Construct without locking.

Definition at line 170 of file lock_vector.hpp.

◆ CMutex() [1/2]

CMutex::CMutex ( const CMutex )
private

Private copy constructor to disallow initialization.

◆ CMutex() [2/2]

CMutex::CMutex ( void  )

Constructor.

◆ Create()

template<class TValue >
CTls<TValue>* CStaticTls_Callbacks< TValue >::Create ( void  )
inline

Definition at line 303 of file ncbithr.hpp.

◆ CreateHolder()

virtual CRWLockHolder* IRWLockHolder_Factory::CreateHolder ( CYieldingRWLock lock,
ERWLockType  typ 
)
pure virtual

Obtain new CRWLockHolder object for given CYieldingRWLock and necessary lock type.

Implemented in CRWLockHolder_Pool.

Referenced by CYieldingRWLock::AcquireLock().

◆ CRWLock() [1/2]

CRWLock::CRWLock ( const CRWLock )
private

Private copy constructor to disallow initialization.

◆ CRWLock() [2/2]

CRWLock::CRWLock ( TFlags  flags = 0)

Constructor.

Definition at line 659 of file ncbimtx.cpp.

References CRWLock::fFavorWriters, CRWLock::fTrackReaders, CRWLock::m_Flags, and CRWLock::m_Readers.

◆ CRWLockHolder() [1/2]

CRWLockHolder::CRWLockHolder ( const CRWLockHolder )
private

◆ CRWLockHolder() [2/2]

CRWLockHolder::CRWLockHolder ( IRWLockHolder_Factory factory)

Create lock holder bound to given object factory.

◆ CSemaphore() [1/2]

CSemaphore::CSemaphore ( const CSemaphore )
private

Private copy constructor to disallow initialization.

◆ CSemaphore() [2/2]

CSemaphore::CSemaphore ( unsigned int  init_count,
unsigned int  max_count 
)

Constructor.

Parameters
int_countThe initial value of the semaphore.
max_countMaximum value that semaphore value can be incremented to. NOTE: On Windows max_count can not be greater than LONG_MAX.

Definition at line 1696 of file ncbimtx.cpp.

References SSemaphore::cond, SSemaphore::count, ERR_POST, Error(), CSemaphore::m_Sem, SSemaphore::max_count, min(), SSemaphore::mutex, NULL, SSemaphore::wait_count, xncbi_Validate, and xncbi_ValidatePthread.

◆ CSpinLock() [1/2]

CSpinLock::CSpinLock ( const CSpinLock )
private

Prohibit copying of the object.

◆ CSpinLock() [2/2]

CSpinLock::CSpinLock ( void  )

◆ CStaticTls()

template<class TValue >
CStaticTls< TValue >::CStaticTls ( FUserCleanup  user_cleanup = 0,
TLifeSpan  life_span = TLifeSpan::GetDefault() 
)
inline

Definition at line 329 of file ncbithr.hpp.

◆ CStaticTls_Callbacks()

template<class TValue >
CStaticTls_Callbacks< TValue >::CStaticTls_Callbacks ( FUserCleanup  cleanup)
inline

Definition at line 301 of file ncbithr.hpp.

◆ CThread() [1/2]

CThread::CThread ( const CThread )
private

Prohibit copying and assigning.

◆ CThread() [2/2]

CThread::CThread ( void  )

Constructor.

Must be allocated in the heap only!.

Definition at line 645 of file ncbithr.cpp.

References CObject::DoDeleteThisObject().

◆ CTls()

template<class TValue >
CTls< TValue >::CTls ( void  )
inline

Definition at line 168 of file ncbithr.hpp.

◆ CTlsBase()

CTlsBase::CTlsBase ( bool  auto_destroy)
inlineprotected

Constructor.

Definition at line 91 of file ncbithr.hpp.

◆ CUsedTlsBases() [1/2]

CUsedTlsBases::CUsedTlsBases ( const CUsedTlsBases )
private

◆ CUsedTlsBases() [2/2]

CUsedTlsBases::CUsedTlsBases ( void  )

Definition at line 72 of file ncbithr.cpp.

Referenced by CUsedTlsBases::GetUsedTlsBases().

◆ CYieldingRWLock()

CYieldingRWLock::CYieldingRWLock ( IRWLockHolder_Factory factory = NULL)

Create read/write lock with custom holders factory.

By default (if factory == NULL) pooling of CRWLockHolder will be used.

Definition at line 2208 of file ncbimtx.cpp.

References eReadLock, eWriteLock, CYieldingRWLock::m_Factory, CYieldingRWLock::m_Locks, and s_RWHolderPool.

◆ DefaultCleanup()

template<class TValue >
static void CTlsBase::DefaultCleanup ( TValue *  value,
void *   
)
inlinestatic

Definition at line 148 of file ncbithr.hpp.

References rapidjson::value.

◆ DeleteHolder()

virtual void IRWLockHolder_Factory::DeleteHolder ( CRWLockHolder holder)
pure virtual

Free unnecessary (and unreferenced by anybody) CRWLockHolder object.

Implemented in CRWLockHolder_Pool.

Referenced by CRWLockHolder::DeleteThis().

◆ DeleteThis()

void CRWLockHolder::DeleteThis ( void  )
privatevirtual

"Delete" this holder after last reference was removed.

Actually deletes using factory's DeleteHolder().

Reimplemented from CObject.

Definition at line 2112 of file ncbimtx.cpp.

References IRWLockHolder_Factory::DeleteHolder(), and CRWLockHolder::m_Factory.

◆ Deregister()

void CUsedTlsBases::Deregister ( CTlsBase tls)

◆ Destroy() [1/2]

void SSystemFastMutex::Destroy ( void  )

Destroy mutex.

Definition at line 217 of file ncbimtx.cpp.

References xncbi_Validate.

◆ Destroy() [2/2]

void SSystemMutex::Destroy ( void  )

Destroy mutex.

Definition at line 249 of file ncbimtx.cpp.

References xncbi_Validate.

◆ DestroyHandle()

void SSystemFastMutex::DestroyHandle ( void  )

Destroy mutex handle.

Must be called only once.

Definition at line 168 of file ncbimtx.cpp.

References WRITE_MUTEX_EVENT, and xncbi_VerifyAndErrorReport.

◆ Detach()

void CThread::Detach ( void  )

Inform the thread that user does not need to wait for its termination.

The thread object will be destroyed by Exit(). If the thread has already been terminated by Exit, Detach() will also schedule the thread object for destruction. NOTE: it is no more safe to use this thread object after Detach(), unless there are still CRef<> based references to it!

Definition at line 833 of file ncbithr.cpp.

References CThread::m_Handle, CThread::m_IsDetached, CThread::m_IsRun, CThread::m_IsTerminated, CThread::m_SelfRef, NCBI_THREAD_VALIDATE, NULL, and CRef< C, Locker >::Reset().

Referenced by CPoolOfThreads< CRef< CStdRequest > >::Register().

◆ Discard() [1/2]

template<class TValue >
void CTls< TValue >::Discard ( void  )
inline

Discard thread local storage.

Schedule the TLS to be destroyed as soon as there are no CRef to it left.

Definition at line 223 of file ncbithr.hpp.

◆ Discard() [2/2]

bool CThread::Discard ( void  )

If the thread has not been Run() yet, then schedule the thread object for destruction, and return TRUE.

Otherwise, do nothing, and return FALSE.

Definition at line 923 of file ncbithr.cpp.

References CThread::m_IsRun, CThread::m_SelfRef, and CRef< C, Locker >::Reset().

Referenced by CAsyncTaskProcessor< TTask >::CExecutor::SThread::Stop().

◆ DoLock()

template<class TLockVect >
void CLockVectorGuard< TLockVect >::DoLock

Lock acquisition.

Definition at line 208 of file lock_vector.hpp.

References _ASSERT, i, msg(), NCBI_THROW, SleepMilliSec(), and NStr::UIntToString().

Referenced by CLockVectorGuard< TLockVect >::CLockVectorGuard().

◆ Exit()

void CThread::Exit ( void *  exit_data)
static

Cancel current thread.

If the thread is detached, then schedule the thread object for destruction. Cancellation is performed by throwing an exception of type CExitThreadException to allow destruction of all objects in thread's stack, so Exit() method shell not be called from any destructor.

Definition at line 906 of file ncbithr.cpp.

References CThread::GetCurrentThread(), CThread::m_ExitData, and NCBI_THREAD_VALIDATE.

Referenced by CResolveRequestFatal::Process(), CFatalRequest_ForServer::Process(), CFatalRequest::Process(), and CIStreamIteratorThread_Base< TRoot, TObject >::SetObject().

◆ FreeUnusedMem()

template<class BV >
void CLockVector< BV >::FreeUnusedMem

Reclaim unused memory.

Definition at line 315 of file lock_vector.hpp.

Referenced by CBDB_Cache::Purge().

◆ FromVoidP() [1/2]

template<class V >
template<class A >
static A CSimpleStaticTls< V >::SCaster< A >::FromVoidP ( void *  p)
inlinestatic

Definition at line 245 of file ncbithr.hpp.

References A.

Referenced by CSimpleStaticTls< V >::operator value_type().

◆ FromVoidP() [2/2]

template<class V >
template<class A >
static A* CSimpleStaticTls< V >::SCaster< A * >::FromVoidP ( void *  p)
inlinestatic

Definition at line 253 of file ncbithr.hpp.

References A.

◆ GetCurrent()

static CThreadSystemID CThreadSystemID::GetCurrent ( void  )
inlinestatic

Get the current thread ID.

Definition at line 185 of file ncbimtx.hpp.

References GetCurrentThreadSystemID(), and CThreadSystemID::m_ID.

◆ GetCurrentThread()

CThread * CThread::GetCurrentThread ( void  )
static

Get current CThread object (or NULL, if main thread)

Definition at line 508 of file ncbithr.cpp.

Referenced by CThread::Exit(), and CPrefetchManager::IsActive().

◆ GetCurrentThreadSystemID()

static TThreadSystemID GetCurrentThreadSystemID ( void  )
inlinestatic

◆ GetErrCodeString() [1/3]

const char * CMutexException::GetErrCodeString ( void  ) const
overridevirtual

Translate from the error code value to its string representation.

Reimplemented from CCoreException.

Definition at line 500 of file ncbimtx.cpp.

References CMutexException::eLock, CMutexException::eOwner, CMutexException::eTryLock, CMutexException::eUninitialized, CMutexException::eUnlock, CCoreException::GetErrCode(), and CException::GetErrCodeString().

◆ GetErrCodeString() [2/3]

const char * CConditionVariableException::GetErrCodeString ( void  ) const
overridevirtual

◆ GetErrCodeString() [3/3]

const char * CThreadException::GetErrCodeString ( void  ) const
overridevirtual

Translate from the error code value to its string representation.

Definition at line 994 of file ncbithr.cpp.

References CThreadException::eControlError, CThreadException::eOther, CThreadException::eRunError, and CException::GetErrCodeString().

◆ GetFactory()

IRWLockHolder_Factory* CRWLockHolder::GetFactory ( void  ) const

Get factory which this object was created from.

◆ GetHandle()

TSystemMutex* CFastMutex::GetHandle ( void  )
inlineprivate

Get handle - Unix version.

Also used by CRWLock.

Definition at line 702 of file ncbimtx.hpp.

References CFastMutex::m_Mutex.

◆ GetId()

template<class TLockVect >
unsigned CLockVectorGuard< TLockVect >::GetId ( void  ) const
inline

Get BLOB id.

Definition at line 135 of file lock_vector.hpp.

Referenced by CBDB_Cache::GetWriteStream(), and CBDB_Cache::x_Store().

◆ GetLockType()

ERWLockType CRWLockHolder::GetLockType ( void  ) const

Get type of lock held.

◆ GetLockVector()

template<class TLockVect >
TLockVector& CLockVectorGuard< TLockVect >::GetLockVector ( ) const
inline

Definition at line 155 of file lock_vector.hpp.

◆ GetRWLock()

CYieldingRWLock* CRWLockHolder::GetRWLock ( void  ) const

Get lock object that is locked by this holder.

◆ GetSelf()

CThread::TID CThread::GetSelf ( void  )
static

◆ GetSystemID()

void CThread::GetSystemID ( TThreadSystemID id)
static

Get system ID of the current thread - for internal use only.

The ID is unique only while the thread is running and may be re-used by another thread later.

Definition at line 946 of file ncbithr.cpp.

References GetCurrentThreadSystemID().

Referenced by CTSE_LoadLock::ReleaseLoadLock(), and CDataSource::x_SetLoadLock().

◆ GetThreadHandle()

TThreadHandle CThread::GetThreadHandle ( )
inlineprotected

Definition at line 778 of file ncbithr.hpp.

References CThread::m_Handle.

◆ GetThreadsCount()

unsigned int CThread::GetThreadsCount ( )
inlinestatic

Get total amount of threads This amount does not contain main thread.

Definition at line 785 of file ncbithr.hpp.

References CThread::sm_ThreadsCount.

Referenced by CSyncQueue_DefaultTraits::IsUsedConcurrently(), s_Daemonize(), and CSafeStaticGuard::~CSafeStaticGuard().

◆ GetTimeout()

template<class TLockVect >
unsigned CLockVectorGuard< TLockVect >::GetTimeout ( void  ) const
inline

Definition at line 156 of file lock_vector.hpp.

◆ GetUsedTlsBases()

CUsedTlsBases & CUsedTlsBases::GetUsedTlsBases ( void  )
static

◆ GetValue() [1/2]

template<class TValue >
TValue* CStaticTls< TValue >::GetValue ( void  )
inline

◆ GetValue() [2/2]

template<class TValue >
TValue* CTls< TValue >::GetValue ( void  ) const
inline

Get the pointer previously stored by SetValue().

Return 0 if no value has been stored, or if Reset() was last called.

See also
SetValue()

Definition at line 179 of file ncbithr.hpp.

Referenced by CCgiApplication::x_GetProcessor(), CCgiApplication::x_GetProcessorOrNull(), CLDS2_UrlHandler_File::x_GetStreamCache(), and CCgiApplication::x_IsSetProcessor().

◆ Init() [1/2]

void CRWLockHolder::Init ( CYieldingRWLock lock,
ERWLockType  typ 
)

Initialize holder for given CYieldingRWLock and necessary lock type.

Method is for use only inside IRWLockHolder_Factory implementation

Referenced by CRWLockHolder_Pool::CreateHolder().

◆ Init() [2/2]

void CUsedTlsBases::Init ( void  )
static

Init TLS, call before creating thread.

Definition at line 168 of file ncbithr.cpp.

References CSafeStatic< T, Callbacks >::Get(), and CUsedTlsBases::sm_UsedTlsBases.

Referenced by CThread::Run().

◆ InitializeDynamic() [1/2]

void SSystemFastMutex::InitializeDynamic ( void  )

Initialize dynamic mutex.

Initialize mutex if it located in heap or stack. This must be called only once. Do not count on zeroed memory values for initializing mutex values.

Definition at line 207 of file ncbimtx.cpp.

◆ InitializeDynamic() [2/2]

void ncbi_namespace_mutex_mt::SSystemMutex::InitializeDynamic ( void  )

Initialize dynamic mutex.

Initialize mutex if it located in heap or stack. This must be called only once. Do not count on zeroed memory values for initializing mutex values.

◆ InitializeHandle()

void SSystemFastMutex::InitializeHandle ( void  )

Initialize mutex handle.

Must be called only once.

Definition at line 136 of file ncbimtx.cpp.

References FALSE, NULL, WRITE_MUTEX_EVENT, xncbi_ValidateAndErrnoReport, and xncbi_ValidatePthread.

◆ InitializeMainThreadId()

void CThread::InitializeMainThreadId ( void  )
static

Initialize main thread's TID.

The function must be called from the main thread if the application is using non-toolkit threads. Otherwise getting thread id of a native thread will return zero.

Definition at line 482 of file ncbithr.cpp.

References _ASSERT, ERR_POST, kMainThreadId, sm_MainThreadIdInitialized, and sx_MainThreadId.

Referenced by CNcbiApplicationAPI::CNcbiApplicationAPI(), CThreadedApp::CThreadedApp(), CThread::GetSelf(), CThread::IsMain(), and main().

◆ InitializeStatic() [1/2]

void SSystemFastMutex::InitializeStatic ( void  )

Initialize static mutex.

Must be called only once.

Definition at line 186 of file ncbimtx.cpp.

References xncbi_Validate.

◆ InitializeStatic() [2/2]

void ncbi_namespace_mutex_mt::SSystemMutex::InitializeStatic ( void  )

Initialize static mutex.

Must be called only once.

◆ Is()

bool CThreadSystemID::Is ( const CThreadSystemID tid) const volatile
inline

Definition at line 209 of file ncbimtx.hpp.

References CThreadSystemID::m_ID.

◆ IsAppExiting()

static bool CThread::IsAppExiting ( void  )
inlinestatic

Check if the application is exiting (entered the destructor).

Recommended to be used as while() condition by infinite threads to stop them properly on exit.

See also
SetWaitForAllThreadsTimeout

Definition at line 629 of file ncbithr.hpp.

References CThread::sm_IsExiting.

◆ IsInitialized() [1/2]

bool ncbi_namespace_mutex_mt::SSystemFastMutex::IsInitialized ( void  ) const

Check if mutex is initialized.

Returns
TRUE if initialized; FALSE, otherwise.

◆ IsInitialized() [2/2]

bool ncbi_namespace_mutex_mt::SSystemMutex::IsInitialized ( void  ) const

Check if mutex is initialized.

Returns
TRUE if initialized; FALSE, otherwise.

◆ IsLockAcquired()

bool CRWLockHolder::IsLockAcquired ( void  ) const

Check if lock requested is already granted.

◆ IsLocked() [1/3]

template<class BV >
bool CLockVector< BV >::IsLocked ( unsigned  id) const

Check if id is locked or not.

Definition at line 322 of file lock_vector.hpp.

Referenced by CBDB_Cache::IsLocked().

◆ IsLocked() [2/3]

bool CYieldingRWLock::IsLocked ( void  )

Check if any type of lock on this object is held.

◆ IsLocked() [3/3]

bool CSpinLock::IsLocked ( void  ) const

Check if mutex is currently locked.

◆ IsMain()

bool CThread::IsMain ( void  )
static

◆ IsNot()

bool CThreadSystemID::IsNot ( const CThreadSystemID tid) const volatile
inline

Definition at line 213 of file ncbimtx.hpp.

References CThreadSystemID::m_ID.

◆ IsSupported()

bool CConditionVariable::IsSupported ( void  )
static

Definition at line 2358 of file ncbimtx.cpp.

◆ IsTerminated()

bool CThread::IsTerminated ( void  ) const
inline

Check if the thread has been terminated.

Definition at line 593 of file ncbithr.hpp.

References CThread::m_IsTerminated.

◆ IsUninitialized() [1/2]

bool ncbi_namespace_mutex_mt::SSystemFastMutex::IsUninitialized ( void  ) const

Check if mutex is un-initialized.

Returns
TRUE if un-initialized; FALSE, otherwise.

◆ IsUninitialized() [2/2]

bool ncbi_namespace_mutex_mt::SSystemMutex::IsUninitialized ( void  ) const

Check if mutex is un-initialized.

Returns
TRUE if un-initialized; FALSE, otherwise.

◆ Join()

void CThread::Join ( void **  exit_data = 0)

◆ Lock() [1/6]

void SSystemFastMutex::Lock ( ELockSemantics  lock = eNormal)

Acquire mutex for the current thread with no nesting checks.

Definition at line 256 of file ncbimtx.cpp.

References WRITE_MUTEX_EVENT.

◆ Lock() [2/6]

void SSystemMutex::Lock ( SSystemFastMutex::ELockSemantics  lock = SSystemFastMutex::eNormal)

Acquire mutex for the current thread.

Definition at line 352 of file ncbimtx.cpp.

References assert, count, and GetCurrentThreadSystemID().

◆ Lock() [3/6]

template<class TLockVect >
void CLockVectorGuard< TLockVect >::Lock ( unsigned  id)

Acquire lock.

Definition at line 247 of file lock_vector.hpp.

Referenced by CBDB_Cache::BlobCheckIn().

◆ Lock() [4/6]

void CFastMutex::Lock ( void  )

◆ Lock() [5/6]

void CMutex::Lock ( void  )

Lock mutex.

Operation:

  • If the mutex is unlocked, then acquire it for the calling thread.
  • If the mutex is acquired by this thread, then increase the lock counter (each call to Lock() must have corresponding call to Unlock() in the same thread).
  • If the mutex is acquired by another thread, then wait until it's unlocked, then act like a Lock() on an unlocked mutex.

Referenced by CGBProject::Lock(), CAppJobDispatcher::Lock(), CSafeStaticPtr_Base::Lock(), and CInfoManager::x_LockInfoMutex().

◆ Lock() [6/6]

void CSpinLock::Lock ( void  )

◆ Main()

virtual void* CThread::Main ( void  )
protectedpure virtual

Derived (user-created) class must provide a real thread function.

Implemented in CBlastNode, CIStreamStdIteratorThread< TRoot, TObject >, CIStreamObjectIteratorThread< TRoot, TObject >, CThreadPool_ServiceThread, CScheduler_ExecThread_Impl, CSeqDBDemo_Thread, CTotalRangeThread, CMTTestThread, CSchedulerEngineThread, CSQLITE_AsyncWritesThread, CInGroupThread, CTestThread, CAsyncDiagThread, CWorkerNodeIdleThread, CGridControlThread, CNetStorageServiceThread, CNSTDBConnectionThread, CJobQueueExecutionWatcherThread, CJobQueueCleanerThread, CServiceThread, CGetJobNotificationThread, CMagicBlastThread, CIgBlastnApp::CIgFormatter, CIgBlastnApp::CIgWorker, CAsyncTaskProcessor< TTask >::CExecutor::SThread, CTblastnNode, CRPSTBlastnNode, CRPSBlastNode, CBlastxNode, CBlastpNode, CBlastnNode, CSearch< LEGACY, NHITS >, CVDBThread, CTestThread, CSeqDBTest3Thread, CSeqDBTest2Thread, CSeqDBTestThread, CDLTest2Thread, CDLTestThread, CHspStreamWriteThread, CBlastKmerThread, CRPSThread, CPrelimSearchThread, CMergeOutputThread, CMergeTreeThread, CThreadInPool< TRequest >, CThreadInPool< CRef< CStdRequest > >, CThreadPool_Thread, CThreadNonStop, CIStreamIteratorThread_Base< TRoot, TObject >, CPrefetchThreadOld, CAssemblyCache::CWorkerThread, CConnTestThread, CThreadInPool_ForServer, CBlastAsyncFormatThread, CLocalAdapterThread, CJobCommitterThread, CGridCleanupThread, SNetScheduleNotificationThread, CMainLoopThread, CAsn2AsnThread, CNWAlignerThread_Align, CThreadDoSM, CThreadRunOnTop, and CSQLITE3_Cache::CWriterThread.

Referenced by CThread::Wrapper().

◆ NCBI_EXCEPTION_DEFAULT() [1/3]

CConditionVariableException::NCBI_EXCEPTION_DEFAULT ( CConditionVariableException  ,
CCoreException   
)

◆ NCBI_EXCEPTION_DEFAULT() [2/3]

CMutexException::NCBI_EXCEPTION_DEFAULT ( CMutexException  ,
CCoreException   
)

◆ NCBI_EXCEPTION_DEFAULT() [3/3]

CThreadException::NCBI_EXCEPTION_DEFAULT ( CThreadException  ,
CException   
)

◆ NCBI_SwapPointers()

void* NCBI_SwapPointers ( void *volatile *  location,
void *  new_value 
)
inline

Definition at line 65 of file ncbiatomic.h.

References a, location, NCBI_SCHED_SPIN_INIT, NCBI_SCHED_SPIN_YIELD, NCBI_SWAP_POINTERS, and tmp.

Referenced by SwapPointers().

◆ OnExit()

void CThread::OnExit ( void  )
protectedvirtual

Override this to execute finalization code.

Unlike destructor, this code will be executed before thread termination and as a part of the thread.

Reimplemented in CSeqDBDemo_Thread, CTestThread, CWorkerNodeIdleThread, CGridControlThread, CIgBlastnApp::CIgFormatter, CIgBlastnApp::CIgWorker, CSearch< LEGACY, NHITS >, CHspStreamWriteThread, CThreadInPool< TRequest >, CThreadInPool< CRef< CStdRequest > >, CThreadPool_Thread, CNWAlignerThread_Align, CThreadDoSM, and CThreadRunOnTop.

Definition at line 940 of file ncbithr.cpp.

Referenced by CGridControlThread::OnExit(), and CThread::Wrapper().

◆ OnLockAcquired()

virtual void IRWLockHolder_Listener::OnLockAcquired ( CRWLockHolder holder)
pure virtual

Callback called when lock represented by CRWLockHolder is acquired.

◆ OnLockReleased()

virtual void IRWLockHolder_Listener::OnLockReleased ( CRWLockHolder holder)
pure virtual

Callback called when lock represented by CRWLockHolder is released.

◆ operator SSystemFastMutex &()

CFastMutex::operator SSystemFastMutex & ( void  )

Get SSystemFastMutex.

◆ operator SSystemMutex &()

CMutex::operator SSystemMutex & ( void  )

Get SSystemMutex.

◆ operator value_type()

template<class V >
CSimpleStaticTls< V >::operator value_type ( ) const
inline

Getter - returns value stored in TLS.

Definition at line 280 of file ncbithr.hpp.

References CSimpleStaticTls< V >::SCaster< A >::FromVoidP(), and CSimpleStaticTls< V >::x_GetKey().

◆ operator!=()

bool CThreadSystemID::operator!= ( const CThreadSystemID tid) const
inline

Non-equality operator for thread ID.

Definition at line 199 of file ncbimtx.hpp.

References CThreadSystemID::m_ID.

◆ operator()() [1/4]

template<class Class >
void SSimpleReadLock< Class >::operator() ( Class &  inst) const
inline

Definition at line 910 of file ncbimtx.hpp.

◆ operator()() [2/4]

template<class Class >
void SSimpleWriteLock< Class >::operator() ( Class &  inst) const
inline

Definition at line 928 of file ncbimtx.hpp.

◆ operator()() [3/4]

template<class Class >
void SSimpleReadUnlock< Class >::operator() ( Class &  inst) const
inline

Definition at line 1072 of file ncbimtx.hpp.

◆ operator()() [4/4]

template<class Class >
void SSimpleWriteUnlock< Class >::operator() ( Class &  inst) const
inline

Definition at line 1091 of file ncbimtx.hpp.

◆ operator=() [1/12]

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

Private assignment operator to disallow assignment.

◆ operator=() [2/12]

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

◆ operator=() [3/12]

template<class BV >
CLockVector& CLockVector< BV >::operator= ( const CLockVector< BV > &  )
private

◆ operator=() [4/12]

template<class TLockVect >
CLockVectorGuard<TLockVect>& CLockVectorGuard< TLockVect >::operator= ( const CLockVectorGuard< TLockVect > &  )
private

◆ operator=() [5/12]

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

Private assignment operator to disallow assignment.

◆ operator=() [6/12]

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

Private assignment operator to disallow assignment.

◆ operator=() [7/12]

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

◆ operator=() [8/12]

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

Private assignment operator to disallow assignment.

◆ operator=() [9/12]

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

◆ operator=() [10/12]

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

◆ operator=() [11/12]

void CUsedTlsBases::operator= ( const CUsedTlsBases )
private

◆ operator=() [12/12]

template<class V >
void CSimpleStaticTls< V >::operator= ( const value_type v)
inline

Setter - changes value stored in TLS.

Definition at line 284 of file ncbithr.hpp.

References CSimpleStaticTls< V >::x_GetKey().

◆ operator==()

bool CThreadSystemID::operator== ( const CThreadSystemID tid) const
inline

Equality operator for thread ID.

Definition at line 193 of file ncbimtx.hpp.

References CThreadSystemID::m_ID.

◆ Post()

void CSemaphore::Post ( unsigned int  count = 1)

Increment the semaphore by "count".

Do nothing and throw an exception if counter would exceed "max_count".

Definition at line 1971 of file ncbimtx.cpp.

References SSemaphore::cond, SSemaphore::count, count, kMax_UInt, CSemaphore::m_Sem, SSemaphore::max_count, SSemaphore::mutex, NULL, SSemaphore::wait_count, xncbi_Validate, xncbi_ValidateAndErrnoReport, and xncbi_ValidatePthread.

Referenced by CThreadPool_Impl::Abort(), CPrefetchTokenOld_Impl::AddResolvedId(), CSchedulerEngine::CancelJob(), CBlastAsyncFormatThread::Finalize(), CTestThread::GlobalSyncPoint(), CThreadGroup::Go(), SServerNotifications::InterruptWait(), SGridWorkerNodeImpl::LeaveExclusiveMode(), CGridCleanupThread::Main(), CBlastAsyncFormatThread::Main(), CIgBlastnApp::CIgWorker::Main(), CAsyncDiagThread::Main(), impl::CDriverContext::MakePooledConnection(), CPSGL_QueueGuard::MarkAsFinished(), CIStreamIteratorThread_Base< TRoot, TObject >::Next(), CPrefetchTokenOld_Impl::NextBioseqHandle(), CScheduler_ExecThread_Impl::OnNextExecutionTimeChange(), CPSGL_RequestTracker::OnStatusChange(), CBlastAsyncFormatThread::QueueResults(), SServerNotifications::RegisterServer(), CPrefetchTokenOld_Impl::RemoveTokenReference(), CThreadNonStop::RequestDoJob(), CWorkerNodeIdleThread::RequestShutdown(), CThreadNonStop::RequestStop(), CGetJobNotificationThread::RequestStop(), CJobQueueCleanerThread::RequestStop(), CJobQueueExecutionWatcherThread::RequestStop(), CWorkerNodeIdleThread::Schedule(), CIStreamIteratorThread_Base< TRoot, TObject >::SetObject(), CSchedulerEngine::ShutDown(), CSchedulerEngine::StartJob(), CIStreamIteratorThread_Base< TRoot, TObject >::Stop(), CAsyncDiagThread::Stop(), CScheduler_ExecThread_Impl::Stop(), CBDB_Cache::StopPurge(), CWorkerNodeIdleThread::Suspend(), CThreadGroup::SyncPoint(), CThreadPool_Impl::TaskFinished(), CThreadGroup::ThreadComplete(), CThreadPool_Impl::ThreadStateChanged(), SGridWorkerNodeImpl::WaitForExclusiveJobToFinish(), CJobCommitterThread::WakeUp(), CGetJobNotificationThread::WakeUp(), CNSTDBConnectionThread::Wakeup(), CThreadPool_ThreadImpl::WakeUp(), CThreadPool_ServiceThread::WakeUp(), impl::CDriverContext::x_Recycle(), CReader::x_ReleaseClosedConnection(), CReader::x_ReleaseConnection(), and CPSGL_RequestTracker::CCallbackGuard::~CCallbackGuard().

◆ ReadLock() [1/2]

void CRWLock::ReadLock ( void  )

◆ ReadLock() [2/2]

void CFastRWLock::ReadLock ( void  )

◆ ReadUnlock()

void CFastRWLock::ReadUnlock ( void  )

Release read lock.

Definition at line 2062 of file ncbimtx.cpp.

References CAtomicCounter::Add(), and CFastRWLock::m_LockCount.

◆ Register()

void CUsedTlsBases::Register ( CTlsBase tls)

◆ Release()

template<class TLockVect >
void CLockVectorGuard< TLockVect >::Release ( void  )
inline

Forger lock.

Definition at line 132 of file lock_vector.hpp.

◆ ReleaseLock()

void CRWLockHolder::ReleaseLock ( void  )

Release the lock held or cancel request for the lock.

Referenced by CRWLockHolder::~CRWLockHolder().

◆ RemoveListener()

void CRWLockHolder::RemoveListener ( IRWLockHolder_Listener listener)

Remove object keeping track of holder state changes.

◆ Reset() [1/2]

void CRWLockHolder::Reset ( void  )

Reset holder to be able to use it later (after calling Init() )

Referenced by CRWLockHolder_Pool::DeleteHolder().

◆ Reset() [2/2]

template<class TValue >
void CTls< TValue >::Reset ( void  )
inline

Reset thread local storage.

Reset thread local storage to its initial value (as it was before the first call to SetValue()). Do cleanup if the cleanup function was specified in the previous call to SetValue().

Reset() will always be called automatically on the thread termination, or when the TLS is destroyed.

Definition at line 217 of file ncbithr.hpp.

Referenced by CCgiApplication::Exit(), and CCgiProcessorGuard::~CCgiProcessorGuard().

◆ Run()

bool CThread::Run ( TRunMode  flags = fRunDefault)

◆ Set()

void CThreadSystemID::Set ( const CThreadSystemID tid) volatile
inline

volatile versions of above methods

Definition at line 205 of file ncbimtx.hpp.

References CThreadSystemID::m_ID.

◆ SetCurrentThreadName()

void CThread::SetCurrentThreadName ( const CTempString )
static

◆ SetId()

template<class TLockVect >
void CLockVectorGuard< TLockVect >::SetId ( unsigned  id)
inline

Assign Id (no locking)

Definition at line 138 of file lock_vector.hpp.

Referenced by CBDB_Cache::BlobCheckIn().

◆ SetValue() [1/2]

template<class TValue >
void CStaticTls< TValue >::SetValue ( TValue *  value,
FCleanup  cleanup = 0,
void *  cleanup_data = 0,
CTlsBase::ENativeThreadCleanup  native = CTlsBase::eSkipCleanup 
)
inline

◆ SetValue() [2/2]

template<class TValue >
void CTls< TValue >::SetValue ( TValue *  value,
FCleanup  cleanup = 0,
void *  cleanup_data = 0,
ENativeThreadCleanup  native = eSkipCleanup 
)
inline

Set value.

Cleanup previously stored value, and set the new value. The "cleanup" function and "cleanup_data" will be used to destroy the new "value" in the next call to SetValue() or Reset(). Do not cleanup if the new value is equal to the old one.

Parameters
valueNew value to set.
cleanupCleanup function. Do not cleanup if default of 0 is specified or if new value is the same as old value.
cleanup_dataOne of the parameters to the cleanup function.
See also
GetValue()

Definition at line 203 of file ncbithr.hpp.

Referenced by CCgiApplication::x_CreateProcessor(), and CLDS2_UrlHandler_File::x_GetStreamCache().

◆ SetWaitForAllThreadsTimeout()

void CThread::SetWaitForAllThreadsTimeout ( const CTimeout timeout)
static

Set timeout for stopping all threads on application exit.

Definition at line 968 of file ncbithr.cpp.

References CThread::sm_WaitForThreadsTimeout.

◆ SignalAll()

void CConditionVariable::SignalAll ( void  )

Wake all threads that are currently waiting on the condition variable.

See also
WaitForSignal, SignalSome

Definition at line 2616 of file ncbimtx.cpp.

References CConditionVariable::m_ConditionVar, and NCBI_THROW.

Referenced by CNCMMCentral::PrepareToStop(), CBlockingQueue_ForServer::Put(), and CTSE_LoadLockGuard::Release().

◆ SignalSome()

void CConditionVariable::SignalSome ( void  )

Wake at least one of the threads that are currently waiting on this condition variable (if any threads are waiting on it).

Note
More than one thread can be awaken.
See also
WaitForSignal, SignalAll

Definition at line 2594 of file ncbimtx.cpp.

References CConditionVariable::m_ConditionVar, and NCBI_THROW.

Referenced by CAsyncTaskProcessor< CRemoteAppReaperTask >::CContext::ExecutorImplStop(), CAsyncTaskProcessor< TTask >::CContext::SchedulerImpl(), and CBlastNodeMailbox::SendMsg().

◆ TakeFrom()

template<class BV >
void CLockVectorGuard< BV >::TakeFrom ( CLockVectorGuard< TLockVect > &  lg)

Transfer lock ownership from another lock.

Parameters
lgOld lock guard (lock src)

Definition at line 271 of file lock_vector.hpp.

References lg().

Referenced by CBDB_CacheIReader::CBDB_CacheIReader(), and CBDB_CacheIWriter::CBDB_CacheIWriter().

◆ ThrowLockFailed()

void SSystemFastMutex::ThrowLockFailed ( void  )
static

Throw lock failed("eLocked") exception.

Definition at line 233 of file ncbimtx.cpp.

References NCBI_THROW.

◆ ThrowNotOwned()

void SSystemMutex::ThrowNotOwned ( void  )
static

Throw not owned("eOwner") exception.

Definition at line 418 of file ncbimtx.cpp.

References NCBI_THROW.

◆ ThrowTryLockFailed()

void SSystemFastMutex::ThrowTryLockFailed ( void  )
static

Throw try lock failed("eTryLock") exception.

Definition at line 243 of file ncbimtx.cpp.

References NCBI_THROW.

◆ ThrowUninitialized()

void SSystemFastMutex::ThrowUninitialized ( void  )
static

Throw uninitialized ("eUninitialized") exception.

Definition at line 228 of file ncbimtx.cpp.

References eUninitialized, and NCBI_THROW.

◆ ThrowUnlockFailed()

void SSystemFastMutex::ThrowUnlockFailed ( void  )
static

Throw unlock failed("eUnlocked") exception.

Definition at line 238 of file ncbimtx.cpp.

References NCBI_THROW.

◆ ToVoidP() [1/2]

template<class V >
template<class A >
static const void* CSimpleStaticTls< V >::SCaster< A * >::ToVoidP ( A v)
inlinestatic

Definition at line 256 of file ncbithr.hpp.

◆ ToVoidP() [2/2]

template<class V >
template<class A >
static const void* CSimpleStaticTls< V >::SCaster< A >::ToVoidP ( A  v)
inlinestatic

Definition at line 248 of file ncbithr.hpp.

◆ TryLock() [1/6]

template<class BV >
bool CLockVector< BV >::TryLock ( unsigned  id)

Try to acquire lock of specified id.

Returns
TRUE if lock was issued, FALSE if object has already being locked.

Definition at line 296 of file lock_vector.hpp.

Referenced by CBDB_Cache::GetNextBlobId().

◆ TryLock() [2/6]

bool SSystemFastMutex::TryLock ( void  )

Try to lock.

Returns
TRUE on success; FALSE, otherwise.

Definition at line 284 of file ncbimtx.cpp.

References WRITE_MUTEX_EVENT.

◆ TryLock() [3/6]

bool SSystemMutex::TryLock ( void  )

Try to lock.

Returns
TRUE on success; FALSE, otherwise.

Definition at line 371 of file ncbimtx.cpp.

References assert, count, and GetCurrentThreadSystemID().

◆ TryLock() [4/6]

bool CFastMutex::TryLock ( void  )

Try locking the mutex.

◆ TryLock() [5/6]

bool CMutex::TryLock ( void  )

Try locking mutex.

Try to acquire the mutex.

Returns
TRUE if succesfully acquired; FALSE otherwise (e.g if the mutex is already acquired by another thread).
See also
Lock()

Referenced by CAppJobDispatcher::OnEngineJobStateChanged().

◆ TryLock() [6/6]

bool CSpinLock::TryLock ( void  )

Attempt to lock the mutex and return TRUE if it succeeded or FALSE if mutex is locked by other thread.

Definition at line 2336 of file ncbimtx.cpp.

References CSpinLock::m_Value, NULL, and SwapPointers().

◆ TryReadLock() [1/2]

bool CRWLock::TryReadLock ( const CTimeout timeout)

◆ TryReadLock() [2/2]

bool CRWLock::TryReadLock ( void  )

Try read lock.

Try to acquire R-lock and return immediately.

Returns
TRUE if the R-lock has been successfully acquired; FALSE, otherwise.

Definition at line 976 of file ncbimtx.cpp.

References _VERIFY, CRWLock::fTrackReaders, GetCurrentThreadSystemID(), interlocked_dec_max(), interlocked_inc_min(), CRWLock::m_Count, CRWLock::m_Flags, CRWLock::m_Owner, CRWLock::m_Readers, CRWLock::m_RW, CRWLock::x_MayAcquireForReading(), and xncbi_Validate.

Referenced by s_LOCK_Handler(), and CRWLock::TryReadLock().

◆ TryWait() [1/2]

bool CSemaphore::TryWait ( const CTimeout timeout)

Timed wait. Wait time specified by CTimeout.

Definition at line 1958 of file ncbimtx.cpp.

References CTimeout::GetNano(), CTimeout::IsInfinite(), CSemaphore::TryWait(), and CSemaphore::Wait().

◆ TryWait() [2/2]

bool CSemaphore::TryWait ( unsigned int  timeout_sec = 0,
unsigned int  timeout_nsec = 0 
)

◆ TryWriteLock() [1/2]

bool CRWLock::TryWriteLock ( const CTimeout timeout)

◆ TryWriteLock() [2/2]

bool CRWLock::TryWriteLock ( void  )

Try write lock.

Try to acquire W-lock and return immediately.

Returns
TRUE if the W-lock has been successfully acquired; FALSE, otherwise.

Definition at line 1320 of file ncbimtx.cpp.

References _ASSERT, _VERIFY, GetCurrentThreadSystemID(), HANDLE, interlocked_dec_max(), interlocked_set(), CRWLock::m_Count, CRWLock::m_Owner, CRWLock::m_Readers, CRWLock::m_RW, TRUE, and xncbi_Validate.

Referenced by s_LOCK_Handler(), and CRWLock::TryWriteLock().

◆ Unlock() [1/8]

template<class TLockVect >
void CLockVectorGuard< TLockVect >::Unlock ( void  )

Unlocks the lock.

Definition at line 255 of file lock_vector.hpp.

References _ASSERT, msg(), NCBI_THROW, and NStr::UIntToString().

Referenced by CBDB_CacheIWriter::Flush().

◆ Unlock() [2/8]

void SSystemFastMutex::Unlock ( ELockSemantics  lock = eNormal)

Release mutex with no owner or nesting checks.

Definition at line 324 of file ncbimtx.cpp.

References WRITE_MUTEX_EVENT.

◆ Unlock() [3/8]

void SSystemMutex::Unlock ( SSystemFastMutex::ELockSemantics  lock = SSystemFastMutex::eNormal)

Release mutex.

Definition at line 395 of file ncbimtx.cpp.

References count, and GetCurrentThreadSystemID().

◆ Unlock() [4/8]

template<class BV >
bool CLockVector< BV >::Unlock ( unsigned  id)

Unlock object.

Returns
TRUE if object unlocked successfully, FALSE if it was not locked

Definition at line 304 of file lock_vector.hpp.

References _ASSERT.

◆ Unlock() [5/8]

void CFastMutex::Unlock ( void  )

◆ Unlock() [6/8]

void CMutex::Unlock ( void  )

Unlock mutex.

Operation:

  • If the mutex is acquired by this thread, then decrease the lock counter.
  • If the lock counter becomes zero, then release the mutex completely.
  • Report error if the mutex is not locked or locked by another thread.

Referenced by CAppJobDispatcher::OnEngineJobStateChanged(), CGBProject::Unlock(), CAppJobDispatcher::Unlock(), CSafeStaticPtr_Base::Unlock(), and CInfoManager::x_UnlockInfoMutex().

◆ Unlock() [7/8]

void CSpinLock::Unlock ( void  )

◆ Unlock() [8/8]

void CRWLock::Unlock ( void  )

◆ Wait()

void CSemaphore::Wait ( void  )

◆ WaitForAllThreads()

bool CThread::WaitForAllThreads ( void  )
staticprivate

◆ WaitForSignal() [1/2]

bool CConditionVariable::WaitForSignal ( CFastMutex mutex,
const CDeadline deadline = CDeadline::eInfinite 
)

Release mutex and lock the calling thread until the condition variable is signalled.

Parameters
mutexMutex to release while waiting for a signal. At the time of the call the mutex must be locked by this thread. Otherwise, an exception will be thrown.
deadlineThe wait will time out when system time equals or exceeds the absolute time specified in 'deadline'
Returns
TRUE when condition variable is signalled; FALSE if timed out
See also
SignalSome, SignalAll, CConditionVariableException

Definition at line 2579 of file ncbimtx.cpp.

References CFastMutex::Unlock(), and CConditionVariable::x_WaitForSignal().

◆ WaitForSignal() [2/2]

bool CConditionVariable::WaitForSignal ( CMutex mutex,
const CDeadline deadline = CDeadline::eInfinite 
)

Release mutex and lock the calling thread until the condition variable is signalled.

Parameters
mutexMutex to release while waiting for a signal. At the time of the call the mutex must be locked by this thread exactly once. Otherwise, an exception will be thrown.
deadlineThe wait will time out when system time equals or exceeds the absolute time specified in 'deadline'
Returns
  • TRUE when condition variable is signalled
  • FALSE if the wait has timed out
See also
SignalSome, SignalAll, CConditionVariableException

Definition at line 2554 of file ncbimtx.cpp.

References GetCurrentThreadSystemID(), NCBI_THROW, and CConditionVariable::x_WaitForSignal().

Referenced by CBlockingQueue_ForServer::GetHandle(), WaitCondVar(), CTSE_LoadLockGuard::WaitForSignal(), CNCMMCentral::x_DoBackgroundWork(), and CBlastMasterNode::x_WaitForNewEvent().

◆ Wrapper()

TWrapperRes CThread::Wrapper ( TWrapperArg  arg)
staticprivate

◆ WriteLock() [1/2]

void CRWLock::WriteLock ( void  )

◆ WriteLock() [2/2]

void CFastRWLock::WriteLock ( void  )

◆ WriteUnlock()

void CFastRWLock::WriteUnlock ( void  )

◆ x_CleanupThreadCallback()

void CTlsBase::x_CleanupThreadCallback ( void *  ptr)
staticprivate

Definition at line 210 of file ncbithr.cpp.

References CTlsBase::CleanupAndDeleteTlsData().

Referenced by CTlsBase::x_Init().

◆ x_DeleteTlsData()

bool CTlsBase::x_DeleteTlsData ( ECleanupMode  mode = eCleanup_Toolkit)
private

Deletes STlsData* structure and managed pointer Returns true if CTlsBase must be deregistered from current thread.

Definition at line 322 of file ncbithr.cpp.

References CTlsBase::CleanupAndDeleteTlsData(), CTlsBase::m_Initialized, CTlsBase::m_Key, s_TlsSetValue(), and CTlsBase::x_GetTlsData().

Referenced by CUsedTlsBases::ClearAll(), and CTlsBase::x_Reset().

◆ x_Destroy()

void CTlsBase::x_Destroy ( void  )
protected

Destroy thread data.

Definition at line 234 of file ncbithr.cpp.

References assert, CTlsBase::m_Initialized, CTlsBase::m_Key, and CTlsBase::x_Reset().

Referenced by CTlsBase::~CTlsBase().

◆ x_GetKey()

template<class V >
key_type CSimpleStaticTls< V >::x_GetKey ( void  ) const
inlineprivate

◆ x_GetKeyLong()

template<class V >
key_type CSimpleStaticTls< V >::x_GetKeyLong ( void  ) const
inlineprivate

◆ x_GetTlsData()

CTlsBase::STlsData * CTlsBase::x_GetTlsData ( void  ) const
inlineprivate

Helper method to get the STlsData*.

Definition at line 725 of file ncbithr.hpp.

References CTlsBase::m_Initialized, and CTlsBase::m_Key.

Referenced by CTlsBase::x_DeleteTlsData(), CTlsBase::x_GetValue(), and CTlsBase::x_SetValue().

◆ x_GetValue()

void * CTlsBase::x_GetValue ( void  ) const
inlineprotected

Helper method to get stored thread data.

Definition at line 747 of file ncbithr.hpp.

References CTlsBase::STlsData::m_Value, and CTlsBase::x_GetTlsData().

Referenced by CTls< CCgiRequestProcessor >::GetValue().

◆ x_Init()

void CTlsBase::x_Init ( void  )
protected

◆ x_InitializeThreadId()

void CThread::x_InitializeThreadId ( void  )
private

initalize new thread id, must be called from Wrapper().

Definition at line 471 of file ncbithr.cpp.

References _ASSERT, and sx_GetNextThreadId().

Referenced by CThread::Wrapper().

◆ x_MayAcquireForReading()

bool CRWLock::x_MayAcquireForReading ( TThreadSystemID  self_id)
inlineprivate

◆ x_OnLockAcquired()

void CRWLockHolder::x_OnLockAcquired ( void  )
private

Callback called at the moment when lock is granted.

Definition at line 2118 of file ncbimtx.cpp.

References CSpinLock::Lock(), CRWLockHolder::m_Listeners, CRWLockHolder::m_ObjLock, NON_CONST_ITERATE, CRef< C, Locker >::NotNull(), and CSpinLock::Unlock().

◆ x_OnLockReleased()

void CRWLockHolder::x_OnLockReleased ( void  )
private

Callback called at the moment when lock is released.

Method is not called if request for lock was canceled before it was actually granted.

Definition at line 2135 of file ncbimtx.cpp.

References CSpinLock::Lock(), CRWLockHolder::m_Listeners, CRWLockHolder::m_ObjLock, NON_CONST_ITERATE, CRef< C, Locker >::NotNull(), and CSpinLock::Unlock().

Referenced by CYieldingRWLock::x_ReleaseLock().

◆ x_ReleaseLock()

void CYieldingRWLock::x_ReleaseLock ( CRWLockHolder holder)
private

◆ x_Reset()

void CTlsBase::x_Reset ( void  )
protected

◆ x_SetValue()

void CTlsBase::x_SetValue ( void *  value,
FCleanupBase  cleanup,
void *  cleanup_data,
ENativeThreadCleanup  native 
)
protected

◆ x_WaitForSignal()

bool CConditionVariable::x_WaitForSignal ( SSystemFastMutex &  mutex,
const CDeadline timeout 
)
private

◆ ~CConditionVariable()

CConditionVariable::~CConditionVariable ( void  )

Definition at line 2400 of file ncbimtx.cpp.

References Critical(), ERR_POST, CConditionVariable::m_ConditionVar, and NCBI_TROUBLE.

◆ ~CFastMutex()

CFastMutex::~CFastMutex ( void  )

Destructor.

Close mutex handle. No checks if it's still acquired.

◆ ~CFastRWLock()

CFastRWLock::~CFastRWLock ( void  )

◆ ~CLockVector()

template<class BV >
CLockVector< BV >::~CLockVector

Definition at line 287 of file lock_vector.hpp.

References ERR_POST_XX.

◆ ~CLockVectorGuard()

template<class TLockVect >
CLockVectorGuard< TLockVect >::~CLockVectorGuard

Definition at line 196 of file lock_vector.hpp.

References ERR_POST_XX.

◆ ~CMutex()

CMutex::~CMutex ( void  )

Destructor.

Report error if the mutex is locked.

◆ ~CRWLock()

CRWLock::~CRWLock ( void  )

Destructor.

Definition at line 679 of file ncbimtx.cpp.

References _ASSERT, and CRWLock::m_Count.

◆ ~CRWLockHolder()

CRWLockHolder::~CRWLockHolder ( void  )
virtual

Definition at line 2104 of file ncbimtx.cpp.

References CRWLockHolder::m_Lock, and CRWLockHolder::ReleaseLock().

◆ ~CSemaphore()

CSemaphore::~CSemaphore ( void  )

Destructor.

Report error if the semaphore is locked.

Definition at line 1758 of file ncbimtx.cpp.

References _ASSERT, SSemaphore::cond, CSemaphore::m_Sem, SSemaphore::mutex, SSemaphore::wait_count, and xncbi_VerifyAndErrorReport.

◆ ~CSpinLock()

CSpinLock::~CSpinLock ( void  )

◆ ~CThread()

CThread::~CThread ( void  )
protectedvirtual

To be called only internally! NOTE: destructor of the derived (user-provided) class should be declared "protected", too!

Definition at line 659 of file ncbithr.cpp.

References CThread::m_Handle, CThread::m_IsRun, and NULL.

◆ ~CTlsBase()

CTlsBase::~CTlsBase ( void  )
inlineprotected

Destructor.

Cleanup data and delete TLS key.

Definition at line 98 of file ncbithr.hpp.

References CTlsBase::m_AutoDestroy, and CTlsBase::x_Destroy().

◆ ~CUsedTlsBases()

CUsedTlsBases::~CUsedTlsBases ( void  )

Definition at line 77 of file ncbithr.cpp.

◆ ~CYieldingRWLock()

CYieldingRWLock::~CYieldingRWLock ( void  )

It is fatal error to destroy the object while some locks are pending.

Thus this object should be destroyed only after calls to ReleaseLock() for all CRWLockHolder objects.

Definition at line 2217 of file ncbimtx.cpp.

References eReadLock, ERR_POST_X, eWriteLock, CYieldingRWLock::m_Locks, CYieldingRWLock::m_LockWaits, CYieldingRWLock::m_ObjLock, and RWLockFatal.

◆ ~IRWLockHolder_Factory()

IRWLockHolder_Factory::~IRWLockHolder_Factory ( void  )
virtual

Definition at line 2100 of file ncbimtx.cpp.

◆ ~IRWLockHolder_Listener()

IRWLockHolder_Listener::~IRWLockHolder_Listener ( void  )
virtual

Definition at line 2097 of file ncbimtx.cpp.

Variable Documentation

◆ kThreadID_None

const CThread::TID kThreadID_None = 0xFFFFFFFF

Definition at line 791 of file ncbithr.hpp.

◆ m_AutoDestroy

bool CTlsBase::m_AutoDestroy
private

Indicates if object should be destroyed in destructor.

Definition at line 124 of file ncbithr.hpp.

Referenced by CUsedTlsBases::ClearAll(), CUsedTlsBases::Deregister(), CUsedTlsBases::Register(), and CTlsBase::~CTlsBase().

◆ m_Cleanup

template<class TValue >
FUserCleanup CStaticTls_Callbacks< TValue >::m_Cleanup
private

Definition at line 313 of file ncbithr.hpp.

Referenced by CStaticTls_Callbacks< CUsedTlsBases >::Cleanup().

◆ m_CleanupData

void* CTlsBase::STlsData::m_CleanupData

Definition at line 131 of file ncbithr.hpp.

Referenced by CTlsBase::CleanupTlsData(), and CTlsBase::x_SetValue().

◆ m_CleanupFunc

FCleanupBase CTlsBase::STlsData::m_CleanupFunc

Definition at line 130 of file ncbithr.hpp.

Referenced by CTlsBase::CleanupTlsData(), and CTlsBase::x_SetValue().

◆ m_ConditionVar

CONDITION_VARIABLE CConditionVariable::m_ConditionVar
private

◆ m_Count [1/2]

atomic<int> ncbi_namespace_mutex_mt::SSystemMutex::m_Count

# of recursive (in the same thread) locks

Definition at line 415 of file ncbimtx.hpp.

◆ m_Count [2/2]

volatile long CRWLock::m_Count
private

◆ m_ExitData

void* CThread::m_ExitData
private

as returned by Main() or passed to Exit()

Definition at line 657 of file ncbithr.hpp.

Referenced by CThread::Exit(), CThread::Join(), and CThread::Wrapper().

◆ m_Factory [1/2]

IRWLockHolder_Factory* CRWLockHolder::m_Factory
private

Factory created the holder.

Definition at line 1286 of file ncbimtx.hpp.

Referenced by CRWLockHolder::DeleteThis().

◆ m_Factory [2/2]

IRWLockHolder_Factory* CYieldingRWLock::m_Factory
private

Factory creating CRWLockHolder objects.

Definition at line 1357 of file ncbimtx.hpp.

Referenced by CYieldingRWLock::AcquireLock(), and CYieldingRWLock::CYieldingRWLock().

◆ m_Flags

TFlags CRWLock::m_Flags
private

◆ m_Handle [1/2]

TSystemMutex ncbi_namespace_mutex_mt::SSystemFastMutex::m_Handle

Mutex handle.

Definition at line 277 of file ncbimtx.hpp.

◆ m_Handle [2/2]

TThreadHandle CThread::m_Handle
private

platform-dependent thread handle

Definition at line 651 of file ncbithr.hpp.

Referenced by CThread::Detach(), CThread::GetThreadHandle(), CThread::Join(), CThread::Run(), and CThread::~CThread().

◆ m_ID

TID CThreadSystemID::m_ID

◆ m_Id

template<class TLockVect >
unsigned CLockVectorGuard< TLockVect >::m_Id
private

◆ m_IdVector

template<class BV >
TBitVector CLockVector< BV >::m_IdVector
protected

vector of locked objs

Definition at line 89 of file lock_vector.hpp.

◆ m_IdVector_Lock

template<class BV >
CFastMutex CLockVector< BV >::m_IdVector_Lock
mutableprotected

lock for m_LockVector

Definition at line 90 of file lock_vector.hpp.

◆ m_Initialized

bool CTlsBase::m_Initialized
private

Indicates if thread data initialized.

Definition at line 123 of file ncbithr.hpp.

Referenced by CTlsBase::x_DeleteTlsData(), CTlsBase::x_Destroy(), CTlsBase::x_GetTlsData(), CTlsBase::x_Init(), and CTlsBase::x_SetValue().

◆ m_IsDetached

bool CThread::m_IsDetached
private

if the thread is detached

Definition at line 653 of file ncbithr.hpp.

Referenced by CThread::Detach(), CThread::Join(), CThread::Run(), and CThread::Wrapper().

◆ m_IsJoined

bool CThread::m_IsJoined
private

if Join() was called for the thread

Definition at line 654 of file ncbithr.hpp.

Referenced by CThread::Join().

◆ m_IsRun

bool CThread::m_IsRun
private

if Run() was called for the thread

Definition at line 652 of file ncbithr.hpp.

Referenced by CThread::Detach(), CThread::Discard(), CThread::Join(), CThread::Run(), and CThread::~CThread().

◆ m_IsTerminated

bool CThread::m_IsTerminated
private

if Exit() was called for the thread

Definition at line 655 of file ncbithr.hpp.

Referenced by CThread::Detach(), CThread::IsTerminated(), and CThread::Wrapper().

◆ m_Key [1/2]

TTlsKey CTlsBase::m_Key
private

◆ m_Key [2/2]

template<class V >
key_type CSimpleStaticTls< V >::m_Key
mutableprivate

◆ m_Listeners

TListenersList CRWLockHolder::m_Listeners
private

List of holder listeners.

Definition at line 1296 of file ncbimtx.hpp.

Referenced by CRWLockHolder::x_OnLockAcquired(), and CRWLockHolder::x_OnLockReleased().

◆ m_Lock

CYieldingRWLock* CRWLockHolder::m_Lock
private

Lock object the holder is assigned to.

Definition at line 1288 of file ncbimtx.hpp.

Referenced by CRWLockHolder::~CRWLockHolder().

◆ m_LockAcquired

bool CRWLockHolder::m_LockAcquired
private

Flag if lock was acquired.

Definition at line 1292 of file ncbimtx.hpp.

Referenced by CYieldingRWLock::x_ReleaseLock().

◆ m_LockCount

CAtomicCounter CFastRWLock::m_LockCount
private

Number of read locks acquired or value of kWriteLockValue if write lock was acquired.

Definition at line 1167 of file ncbimtx.hpp.

Referenced by CFastRWLock::ReadLock(), CFastRWLock::ReadUnlock(), CFastRWLock::WriteLock(), and CFastRWLock::WriteUnlock().

◆ m_Locks

int CYieldingRWLock::m_Locks[2]
private

Number of locks granted on this object by type.

Definition at line 1361 of file ncbimtx.hpp.

Referenced by CYieldingRWLock::AcquireLock(), CYieldingRWLock::CYieldingRWLock(), CYieldingRWLock::x_ReleaseLock(), and CYieldingRWLock::~CYieldingRWLock().

◆ m_LockSet

template<class TLockVect >
bool CLockVectorGuard< TLockVect >::m_LockSet
private

Definition at line 166 of file lock_vector.hpp.

Referenced by CLockVectorGuard< TLockVector >::Release().

◆ m_LockVector

template<class TLockVect >
TLockVector* CLockVectorGuard< TLockVect >::m_LockVector
private

Definition at line 162 of file lock_vector.hpp.

Referenced by CLockVectorGuard< TLockVector >::GetLockVector().

◆ m_LockWaits

THoldersList CYieldingRWLock::m_LockWaits
private

Queue for waiting lock requests.

Definition at line 1363 of file ncbimtx.hpp.

Referenced by CYieldingRWLock::AcquireLock(), CYieldingRWLock::x_ReleaseLock(), and CYieldingRWLock::~CYieldingRWLock().

◆ m_Magic

volatile EMagic ncbi_namespace_mutex_mt::SSystemFastMutex::m_Magic

Magic flag.

Definition at line 284 of file ncbimtx.hpp.

◆ m_Mutex [1/3]

SSystemFastMutex ncbi_namespace_mutex_mt::SSystemMutex::m_Mutex

Mutex value.

Definition at line 411 of file ncbimtx.hpp.

◆ m_Mutex [2/3]

SSystemFastMutex CFastMutex::m_Mutex
private

Platform-dependent mutex handle, also used by CRWLock.

Definition at line 713 of file ncbimtx.hpp.

Referenced by CFastMutex::GetHandle().

◆ m_Mutex [3/3]

SSystemMutex CMutex::m_Mutex
private

System mutex.

Definition at line 799 of file ncbimtx.hpp.

◆ m_Native

ENativeThreadCleanup CTlsBase::STlsData::m_Native

Definition at line 132 of file ncbithr.hpp.

Referenced by CTlsBase::CleanupTlsData(), and CTlsBase::x_SetValue().

◆ m_ObjLock [1/2]

CSpinLock CRWLockHolder::m_ObjLock
private

Mutex for operating listeners.

Definition at line 1294 of file ncbimtx.hpp.

Referenced by CRWLockHolder::x_OnLockAcquired(), and CRWLockHolder::x_OnLockReleased().

◆ m_ObjLock [2/2]

CSpinLock CYieldingRWLock::m_ObjLock
private

Main locking mutex for object operations.

Definition at line 1359 of file ncbimtx.hpp.

Referenced by CYieldingRWLock::AcquireLock(), CYieldingRWLock::x_ReleaseLock(), and CYieldingRWLock::~CYieldingRWLock().

◆ m_Owner [1/2]

atomic<TThreadSystemID> ncbi_namespace_mutex_mt::SSystemMutex::m_Owner

Platform-dependent owner thread ID.

Definition at line 413 of file ncbimtx.hpp.

◆ m_Owner [2/2]

volatile TThreadSystemID CRWLock::m_Owner
private

Writer ID, one of the readers ID.

Definition at line 1045 of file ncbimtx.hpp.

Referenced by CRWLock::ReadLock(), CRWLock::TryReadLock(), CRWLock::TryWriteLock(), CRWLock::Unlock(), and CRWLock::WriteLock().

◆ m_ParentRequestContext

CRef<CRequestContext> CThread::m_ParentRequestContext
private

Definition at line 658 of file ncbithr.hpp.

Referenced by CThread::Run(), and CThread::Wrapper().

◆ m_Readers

vector<TThreadSystemID> CRWLock::m_Readers
private

◆ m_RW

unique_ptr<CInternalRWLock> CRWLock::m_RW
private

Platform-dependent RW-lock data.

Definition at line 1044 of file ncbimtx.hpp.

Referenced by CRWLock::ReadLock(), CRWLock::TryReadLock(), CRWLock::TryWriteLock(), CRWLock::Unlock(), and CRWLock::WriteLock().

◆ m_SelfRef

CRef<CThread> CThread::m_SelfRef
private

"this" – to avoid premature destruction

Definition at line 656 of file ncbithr.hpp.

Referenced by CThread::Detach(), CThread::Discard(), CThread::Join(), CThread::Run(), and CThread::Wrapper().

◆ m_Sem

struct SSemaphore* CSemaphore::m_Sem
private

System-specific semaphore data.

Definition at line 1418 of file ncbimtx.hpp.

Referenced by CSemaphore::CSemaphore(), CSemaphore::Post(), CSemaphore::TryWait(), CSemaphore::Wait(), and CSemaphore::~CSemaphore().

◆ m_Spins

template<class TLockVect >
unsigned CLockVectorGuard< TLockVect >::m_Spins
private

Definition at line 165 of file lock_vector.hpp.

◆ m_Timeout

template<class TLockVect >
unsigned CLockVectorGuard< TLockVect >::m_Timeout
private

Definition at line 164 of file lock_vector.hpp.

Referenced by CLockVectorGuard< TLockVector >::GetTimeout().

◆ m_Type

ERWLockType CRWLockHolder::m_Type
private

Type of lock held.

Definition at line 1290 of file ncbimtx.hpp.

Referenced by CYieldingRWLock::x_ReleaseLock().

◆ m_UsedTls

TTlsSet CUsedTlsBases::m_UsedTls
private

◆ m_Value [1/2]

void* volatile CSpinLock::m_Value
private

Flag showing if mutex is locked (non-NULL value) or unlocked (NULL value).

Definition at line 876 of file ncbimtx.hpp.

Referenced by CSpinLock::Lock(), CSpinLock::TryLock(), and CSpinLock::Unlock().

◆ m_Value [2/2]

void* CTlsBase::STlsData::m_Value

◆ m_WaitCounter

CAtomicCounter_WithAutoInit CConditionVariable::m_WaitCounter
private

Definition at line 1505 of file ncbimtx.hpp.

Referenced by CConditionVariable::x_WaitForSignal().

◆ m_WaitingWriters

volatile unsigned int CRWLock::m_WaitingWriters
private

Number of writers waiting; zero if not keeping track.

Definition at line 1047 of file ncbimtx.hpp.

Referenced by CRWLock::ReadLock(), CRWLock::TryReadLock(), CRWLock::TryWriteLock(), CRWLock::Unlock(), CRWLock::WriteLock(), and CRWLock::x_MayAcquireForReading().

◆ m_WaitMutex

SSystemFastMutex* volatile CConditionVariable::m_WaitMutex
private

Definition at line 1506 of file ncbimtx.hpp.

Referenced by CConditionVariable::x_WaitForSignal().

◆ m_WriteLock

CFastMutex CFastRWLock::m_WriteLock
private

Mutex implementing write lock.

Definition at line 1169 of file ncbimtx.hpp.

Referenced by CFastRWLock::ReadLock(), CFastRWLock::WriteLock(), and CFastRWLock::WriteUnlock().

◆ sm_IsExiting

bool CThread::sm_IsExiting = false
staticprivate

◆ sm_ThreadsCount

atomic< unsigned int > CThread::sm_ThreadsCount
staticprivate

Total amount of threads.

Definition at line 671 of file ncbithr.hpp.

Referenced by CThread::GetThreadsCount(), CThread::Run(), CThread::WaitForAllThreads(), and CThread::Wrapper().

◆ sm_UsedTlsBases

CStaticTls< CUsedTlsBases > CUsedTlsBases::sm_UsedTlsBases
staticprivate

◆ sm_WaitForThreadsTimeout

CTimeout CThread::sm_WaitForThreadsTimeout = CTimeout(0.1)
staticprivate

Friends

◆ ::ncbi::CAutoInitializeStaticFastMutex

friend class ::ncbi::CAutoInitializeStaticFastMutex
friend

Definition at line 377 of file ncbimtx.hpp.

◆ ::ncbi::CAutoInitializeStaticMutex

friend class ::ncbi::CAutoInitializeStaticMutex
friend

Definition at line 472 of file ncbimtx.hpp.

◆ ::ncbi::CFastMutex

friend class ::ncbi::CFastMutex
friend

Definition at line 378 of file ncbimtx.hpp.

◆ ::ncbi::CMutex

friend class ::ncbi::CMutex
friend

Definition at line 473 of file ncbimtx.hpp.

◆ ::ncbi::CSafeStaticPtr_Base

friend class ::ncbi::CSafeStaticPtr_Base
friend

Definition at line 379 of file ncbimtx.hpp.

◆ CNcbiApplicationAPI

friend class CNcbiApplicationAPI
friend

Definition at line 684 of file ncbithr.hpp.

◆ CRef< CThread >

friend class CRef< CThread >
friend

Definition at line 513 of file ncbithr.hpp.

◆ CRef< CTlsBase >

friend class CRef< CTlsBase >
friend

Definition at line 791 of file ncbithr.hpp.

◆ CRWLock [1/2]

friend class CRWLock
friend

Definition at line 710 of file ncbimtx.hpp.

◆ CRWLock [2/2]

friend class CRWLock
friend

Allow use of m_Mtx and m_Owner members directly.

Definition at line 807 of file ncbimtx.hpp.

◆ CRWLockHolder

friend class CRWLockHolder
friend

Definition at line 1317 of file ncbimtx.hpp.

◆ CStaticTlsHelper

friend class CStaticTlsHelper
friend

Definition at line 69 of file ncbithr.hpp.

◆ CTlsBase

friend class CTlsBase
friend

Definition at line 530 of file ncbithr.hpp.

◆ CUsedTlsBases [1/2]

friend class CUsedTlsBases
friend

Definition at line 68 of file ncbithr.hpp.

◆ CUsedTlsBases [2/2]

template<class TValue >
friend class CUsedTlsBases
friend

Definition at line 343 of file ncbithr.hpp.

◆ CYieldingRWLock

friend class CYieldingRWLock
friend

Definition at line 1231 of file ncbimtx.hpp.

◆ SSystemMutex

friend struct SSystemMutex
friend

Definition at line 376 of file ncbimtx.hpp.

◆ ThreadWrapperCaller

TWrapperRes ThreadWrapperCaller ( TWrapperArg  arg)
friend

Definition at line 673 of file ncbithr.cpp.

Modified on Fri Sep 20 14:58:32 2024 by modify_doxy.py rev. 669887