Threads
[CORELIB]

Collaboration diagram for Threads:


Classes

class  CThreadSystemID
 CThreadSystemID --. More...
class  CMutexException
 CMutexException --. More...
struct  SSystemFastMutex
 SSystemFastMutex --. More...
struct  SSystemMutex
 SSystemMutex --. More...
class  CAutoInitializeStaticFastMutex
 CAutoInitializeStaticFastMutex --. More...
class  CAutoInitializeStaticMutex
 CAutoInitializeStaticMutex --. More...
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  CTlsBase
 CTlBase --. More...
class  CTls< TValue >
 CTls --. More...
class  CStaticTls< TValue >
class  CUsedTlsBases
class  CThread
 CThread --. More...
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...

Defines

#define NCBI_SCHED_YIELD()
#define NCBI_SCHED_SPIN_INIT()
#define NCBI_SCHED_SPIN_YIELD()
#define NCBI_COUNTER_UNSIGNED   1
#define NCBI_COUNTER_NEED_MUTEX   1
#define NCBI_SWAP_POINTERS_EXTERN   1
#define NCBI_SLOW_ATOMIC_SWAP   1
#define INTERNAL_MUTEX_DEBUG
 Mutex debug setting.
#define WRITE_MUTEX_EVENT(mutex, message)   ((void)0)
#define THREAD_SYSTEM_ID_INITIALIZER   { 0 }
 Use in defining initial value of system mutex.
#define NEED_AUTO_INITIALIZE_MUTEX
 Auto initialization for mutex will be used.
#define DEFINE_STATIC_FAST_MUTEX(id)   static NCBI_NS_NCBI::CAutoInitializeStaticFastMutex id
 Define auto-initialized static fast mutex.
#define DECLARE_CLASS_STATIC_FAST_MUTEX(id)   static NCBI_NS_NCBI::CAutoInitializeStaticFastMutex id
 Declare auto-initialized static fast mutex.
#define DEFINE_CLASS_STATIC_FAST_MUTEX(id)   NCBI_NS_NCBI::CAutoInitializeStaticFastMutex id
 Define auto-initialized mutex.
#define DEFINE_STATIC_MUTEX(id)   static NCBI_NS_NCBI::CAutoInitializeStaticMutex id
 Define auto-initialized static mutex.
#define DECLARE_CLASS_STATIC_MUTEX(id)   static NCBI_NS_NCBI::CAutoInitializeStaticMutex id
 Declare auto-initialized static mutex.
#define DEFINE_CLASS_STATIC_MUTEX(id)   NCBI_NS_NCBI::CAutoInitializeStaticMutex id
 Define auto-initialized mutex.
#define NCBI_STATIC_TLS_VIA_SAFE_STATIC_REF   1

Typedefs

typedef unsigned int TNCBIAtomicValue
 Define platform specific atomic-operations macros/values.
typedef CGuard< SSystemFastMutexTFastMutexGuard
 typedefs for ease of use
typedef TFastMutexGuard CFastMutexGuard
 ...and backward compatibility
typedef CGuard< SSystemMutexTMutexGuard
 typedefs for ease of use
typedef TMutexGuard CMutexGuard
 ...and backward compatibility
typedef CNoLock CNoMutex
 CNoMutex --.
typedef CGuard< CSpinLockCSpinGuard
typedef CGuard< CRWLock, SSimpleReadLock<
CRWLock > > 
TReadLockGuard
typedef TReadLockGuard CReadLockGuard
typedef CGuard< CRWLock, SSimpleWriteLock<
CRWLock > > 
TWriteLockGuard
typedef TWriteLockGuard CWriteLockGuard
typedef CGuard< CFastRWLock,
SSimpleReadLock< CFastRWLock >,
SSimpleReadUnlock< CFastRWLock > > 
CFastReadGuard
typedef CGuard< CFastRWLock,
SSimpleWriteLock< CFastRWLock >,
SSimpleWriteUnlock< CFastRWLock > > 
CFastWriteGuard
typedef CIRef< IRWLockHolder_ListenerTRWLockHolder_ListenerRef
 Types of smart references to IRWLockHolder_Listener.
typedef CWeakIRef< IRWLockHolder_ListenerTRWLockHolder_ListenerWeakRef
typedef CRef< CRWLockHolderTRWLockHolderRef
 Type that should be always used to store pointers to CRWLockHolder.
typedef void * TTlsKey
 Define internal TLS key type.
typedef int TThreadHandle
 Define platform-dependent thread handle type.
typedef int TThreadSystemID
 Define platform-dependent thread ID type.
typedef void * TWrapperRes
 Define platform-dependent result wrapper.
typedef void * TWrapperArg
 Define platform-dependent argument wrapper.

Enumerations

enum  ERWLockType { eReadLock = 0, eWriteLock = 1 }
 Type of locking provided by CYieldingRWLock. More...

Functions

void * NCBI_SwapPointers (void *volatile *location, void *new_value)
 CLockVectorGuard::CLockVectorGuard (TLockVector &lvect, unsigned timeout_ms)
 Construct without locking.
 CLockVectorGuard::CLockVectorGuard (TLockVector &lvect, unsigned id, unsigned timeout_ms)
 Construct and lock.
 CLockVectorGuard::~CLockVectorGuard ()
void CLockVectorGuard::DoLock ()
 Lock acquisition.
void CLockVectorGuard::Lock (unsigned id)
 Acquire lock.
void CLockVectorGuard::Unlock ()
 Unlocks the lock.
void CLockVectorGuard::TakeFrom (CLockVectorGuard &lg)
 Transfer lock ownership from another lock.
 CLockVector::CLockVector ()
 CLockVector::~CLockVector ()
bool CLockVector::TryLock (unsigned id)
 Try to acquire lock of specified id.
bool CLockVector::Unlock (unsigned id)
 Unlock object.
void CLockVector::FreeUnusedMem ()
 Reclaim unused memory.
bool CLockVector::IsLocked (unsigned id) const
 Check if id is locked or not.


Define Documentation

#define DECLARE_CLASS_STATIC_FAST_MUTEX id   )     static NCBI_NS_NCBI::CAutoInitializeStaticFastMutex id
 

Declare auto-initialized static fast mutex.

Definition at line 500 of file ncbimtx.hpp.

#define DECLARE_CLASS_STATIC_MUTEX id   )     static NCBI_NS_NCBI::CAutoInitializeStaticMutex id
 

Declare auto-initialized static mutex.

Definition at line 512 of file ncbimtx.hpp.

#define DEFINE_CLASS_STATIC_FAST_MUTEX id   )     NCBI_NS_NCBI::CAutoInitializeStaticFastMutex id
 

Define auto-initialized mutex.

Definition at line 504 of file ncbimtx.hpp.

#define DEFINE_CLASS_STATIC_MUTEX id   )     NCBI_NS_NCBI::CAutoInitializeStaticMutex id
 

Define auto-initialized mutex.

Definition at line 516 of file ncbimtx.hpp.

#define DEFINE_STATIC_FAST_MUTEX id   )     static NCBI_NS_NCBI::CAutoInitializeStaticFastMutex id
 

Define auto-initialized static fast mutex.

Definition at line 496 of file ncbimtx.hpp.

Referenced by CODBCContext::CODBCContext(), CGiCache::GetInstance(), CEntrezCache::GetInstance(), CPluginManagerGetterImpl::GetMutex(), CObjectStoreProtectedBase::GetMutex(), s_CodingPropensity(), s_LoadGuide(), s_SerFlags(), and CFeature_table_reader::x_InitImplementation().

#define DEFINE_STATIC_MUTEX id   )     static NCBI_NS_NCBI::CAutoInitializeStaticMutex id
 

Define auto-initialized static mutex.

Definition at line 508 of file ncbimtx.hpp.

Referenced by CSeqFeatData::GetBondList(), CSeqFeatData::GetFeatList(), CSeqFetchQueue::GetInstance(), CGuiRegistry::GetInstance(), CBookmarkManager::GetInstance(), CProjectViewLinkManager::GetInstance(), CSeqFeatData::GetSiteList(), impl::CDriverContext::ResetEnvSybase(), s_CreateDefaultColorTable(), and CParamBase::s_GetLock().

#define INTERNAL_MUTEX_DEBUG
 

Mutex debug setting.

Definition at line 75 of file ncbimtx.hpp.

#define NCBI_COUNTER_NEED_MUTEX   1
 

Definition at line 256 of file ncbi_atomic_defs.h.

#define NCBI_COUNTER_UNSIGNED   1
 

Definition at line 252 of file ncbi_atomic_defs.h.

 
#define NCBI_SCHED_SPIN_INIT  ) 
 

Definition at line 69 of file ncbi_atomic_defs.h.

Referenced by CAtomicCounter::Get(), and NCBI_SwapPointers().

 
#define NCBI_SCHED_SPIN_YIELD  ) 
 

Definition at line 70 of file ncbi_atomic_defs.h.

Referenced by CAtomicCounter::Get(), and NCBI_SwapPointers().

 
#define NCBI_SCHED_YIELD  ) 
 

Definition at line 68 of file ncbi_atomic_defs.h.

Referenced by CFastRWLock::WriteLock().

#define NCBI_SLOW_ATOMIC_SWAP   1
 

Definition at line 262 of file ncbi_atomic_defs.h.

#define NCBI_STATIC_TLS_VIA_SAFE_STATIC_REF   1
 

Definition at line 203 of file ncbithr.hpp.

#define NCBI_SWAP_POINTERS_EXTERN   1
 

Definition at line 261 of file ncbi_atomic_defs.h.

#define NEED_AUTO_INITIALIZE_MUTEX
 

Auto initialization for mutex will be used.

Definition at line 493 of file ncbimtx.hpp.

#define THREAD_SYSTEM_ID_INITIALIZER   { 0 }
 

Use in defining initial value of system mutex.

Definition at line 207 of file ncbimtx.hpp.

Referenced by CDiagContextThreadData::GetThreadData().

#define WRITE_MUTEX_EVENT mutex,
message   )     ((void)0)
 

Definition at line 104 of file ncbimtx.hpp.

Referenced by SSystemFastMutex::DestroyHandle(), SSystemFastMutex::InitializeHandle(), SSystemFastMutex::Lock(), SSystemFastMutex::TryLock(), and SSystemFastMutex::Unlock().


Typedef Documentation

typedef TFastMutexGuard CFastMutexGuard
 

...and backward compatibility

Definition at line 366 of file ncbimtx.hpp.

typedef CGuard< CFastRWLock, SSimpleReadLock <CFastRWLock>, SSimpleReadUnlock<CFastRWLock> > CFastReadGuard
 

Definition at line 1014 of file ncbimtx.hpp.

typedef CGuard< CFastRWLock, SSimpleWriteLock <CFastRWLock>, SSimpleWriteUnlock<CFastRWLock> > CFastWriteGuard
 

Definition at line 1033 of file ncbimtx.hpp.

typedef TMutexGuard CMutexGuard
 

...and backward compatibility

Definition at line 452 of file ncbimtx.hpp.

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 790 of file ncbimtx.hpp.

typedef TReadLockGuard CReadLockGuard
 

Definition at line 875 of file ncbimtx.hpp.

typedef CGuard<CSpinLock> CSpinGuard
 

Definition at line 793 of file ncbimtx.hpp.

typedef TWriteLockGuard CWriteLockGuard
 

Definition at line 893 of file ncbimtx.hpp.

typedef CGuard<SSystemFastMutex> TFastMutexGuard
 

typedefs for ease of use

Definition at line 363 of file ncbimtx.hpp.

typedef CGuard<SSystemMutex> TMutexGuard
 

typedefs for ease of use

Definition at line 449 of file ncbimtx.hpp.

typedef unsigned int 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 251 of file ncbi_atomic_defs.h.

typedef CGuard<CRWLock, SSimpleReadLock<CRWLock> > TReadLockGuard
 

Definition at line 874 of file ncbimtx.hpp.

typedef CIRef<IRWLockHolder_Listener> TRWLockHolder_ListenerRef
 

Types of smart references to IRWLockHolder_Listener.

Definition at line 1132 of file ncbimtx.hpp.

typedef CWeakIRef<IRWLockHolder_Listener> TRWLockHolder_ListenerWeakRef
 

Definition at line 1133 of file ncbimtx.hpp.

typedef CRef<CRWLockHolder> TRWLockHolderRef
 

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

Definition at line 1230 of file ncbimtx.hpp.

typedef int TThreadHandle
 

Define platform-dependent thread handle type.

Definition at line 111 of file ncbithr_conf.hpp.

typedef int TThreadSystemID
 

Define platform-dependent thread ID type.

Definition at line 114 of file ncbithr_conf.hpp.

typedef void* TTlsKey
 

Define internal TLS key type.

Definition at line 108 of file ncbithr_conf.hpp.

typedef void* TWrapperArg
 

Define platform-dependent argument wrapper.

Definition at line 120 of file ncbithr_conf.hpp.

typedef void* TWrapperRes
 

Define platform-dependent result wrapper.

Definition at line 117 of file ncbithr_conf.hpp.

typedef CGuard<CRWLock, SSimpleWriteLock<CRWLock> > TWriteLockGuard
 

Definition at line 892 of file ncbimtx.hpp.


Enumeration Type Documentation

enum ERWLockType
 

Type of locking provided by CYieldingRWLock.

Enumerator:
eReadLock 
eWriteLock 

Definition at line 1109 of file ncbimtx.hpp.


Function Documentation

template<class BV>
CLockVector< BV >::CLockVector  )  [inherited]
 

Definition at line 281 of file lock_vector.hpp.

template<class TLockVect>
CLockVectorGuard< TLockVect >::CLockVectorGuard TLockVector lvect,
unsigned  id,
unsigned  timeout_ms
[inherited]
 

Construct and lock.

Parameters:
lvect Lock vector storing all locks
id Object Id we are locking
timeout_ms Timeout 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().

template<class TLockVect>
CLockVectorGuard< TLockVect >::CLockVectorGuard TLockVector lvect,
unsigned  timeout_ms
[inherited]
 

Construct without locking.

Definition at line 170 of file lock_vector.hpp.

template<class TLockVect>
void CLockVectorGuard< TLockVect >::DoLock  )  [inherited]
 

Lock acquisition.

Definition at line 208 of file lock_vector.hpp.

References _ASSERT, CLockVectorGuard< TLockVect >::m_Id, CLockVectorGuard< TLockVect >::m_LockSet, CLockVectorGuard< TLockVect >::m_LockVector, and CLockVectorGuard< TLockVect >::m_Spins.

Referenced by CLockVectorGuard< TLockVect >::CLockVectorGuard(), and CLockVectorGuard< TLockVect >::Lock().

template<class BV>
void CLockVector< BV >::FreeUnusedMem  )  [inherited]
 

Reclaim unused memory.

Definition at line 315 of file lock_vector.hpp.

References CLockVector< BV >::m_IdVector, and CLockVector< BV >::m_IdVector_Lock.

template<class BV>
bool CLockVector< BV >::IsLocked unsigned  id  )  const [inherited]
 

Check if id is locked or not.

Definition at line 322 of file lock_vector.hpp.

References CLockVector< BV >::m_IdVector, and CLockVector< BV >::m_IdVector_Lock.

Referenced by CBDB_Cache::IsLocked().

template<class TLockVect>
void CLockVectorGuard< TLockVect >::Lock unsigned  id  )  [inherited]
 

Acquire lock.

Definition at line 247 of file lock_vector.hpp.

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

Referenced by CBDB_Cache::BlobCheckIn().

void* NCBI_SwapPointers void *volatile *  location,
void *  new_value
[inline]
 

Definition at line 65 of file ncbiatomic.h.

References NCBI_SCHED_SPIN_INIT, and NCBI_SCHED_SPIN_YIELD.

Referenced by SwapPointers(), and TRIGGER_Set().

template<class BV>
void CLockVectorGuard< BV >::TakeFrom CLockVectorGuard< TLockVect > &  lg  )  [inherited]
 

Transfer lock ownership from another lock.

Parameters:
lg Old lock guard (lock src)

Definition at line 271 of file lock_vector.hpp.

References CLockVectorGuard< TLockVect >::m_Id, CLockVectorGuard< TLockVect >::m_LockSet, CLockVectorGuard< TLockVect >::m_LockVector, CLockVectorGuard< TLockVect >::Release(), and CLockVectorGuard< TLockVect >::Unlock().

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

template<class BV>
bool CLockVector< BV >::TryLock unsigned  id  )  [inherited]
 

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.

References CLockVector< BV >::m_IdVector, and CLockVector< BV >::m_IdVector_Lock.

Referenced by CBDB_Cache::GetNextBlobId().

template<class BV>
bool CLockVector< BV >::Unlock unsigned  id  )  [inherited]
 

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, CLockVector< BV >::m_IdVector, and CLockVector< BV >::m_IdVector_Lock.

template<class TLockVect>
void CLockVectorGuard< TLockVect >::Unlock  )  [inherited]
 

Unlocks the lock.

Definition at line 255 of file lock_vector.hpp.

References _ASSERT, CLockVectorGuard< TLockVect >::m_Id, CLockVectorGuard< TLockVect >::m_LockSet, CLockVectorGuard< TLockVect >::m_LockVector, NCBI_THROW, and NStr::UIntToString().

Referenced by CLockVectorGuard< TLockVect >::Lock(), CLockVectorGuard< TLockVect >::TakeFrom(), and CLockVectorGuard< TLockVect >::~CLockVectorGuard().

template<class BV>
CLockVector< BV >::~CLockVector  )  [inherited]
 

Definition at line 287 of file lock_vector.hpp.

References ERR_POST_XX, and CLockVector< BV >::m_IdVector.

template<class TLockVect>
CLockVectorGuard< TLockVect >::~CLockVectorGuard  )  [inherited]
 

Definition at line 196 of file lock_vector.hpp.

References ERR_POST_XX, and CLockVectorGuard< TLockVect >::Unlock().


Generated on Wed Dec 9 08:13:37 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Wed Dec 09 08:20:18 2009 by modify_doxy.py rev. 173732