#include <ncbimtx.hpp>
Collaboration diagram for CSemaphore:

Implement the semantics of an application-wide semaphore.
Definition at line 1304 of file ncbimtx.hpp.
Public Member Functions | |
| CSemaphore (unsigned int init_count, unsigned int max_count) | |
| Constructor. | |
| ~CSemaphore (void) | |
| Destructor. | |
| void | Wait (void) |
| Wait on semaphore. | |
| bool | TryWait (unsigned int timeout_sec=0, unsigned int timeout_nsec=0) |
| Timed wait. | |
| void | Post (unsigned int count=1) |
| Increment the semaphore by "count". | |
Private Member Functions | |
| CSemaphore (const CSemaphore &) | |
| Private copy constructor to disallow initialization. | |
| CSemaphore & | operator= (const CSemaphore &) |
| Private assignment operator to disallow assignment. | |
Private Attributes | |
| SSemaphore * | m_Sem |
| System-specific semaphore data. | |
|
||||||||||||
|
Constructor.
Definition at line 1014 of file ncbimtx.cpp. References SSemaphore::count, m_Sem, SSemaphore::max_count, auto_ptr< X >::release(), and xncbi_Validate. |
|
|
Destructor. Report error if the semaphore is locked. Definition at line 1064 of file ncbimtx.cpp. References _ASSERT, m_Sem, and xncbi_Verify. |
|
|
Private copy constructor to disallow initialization.
|
|
|
Private assignment operator to disallow assignment.
|
|
|
||||||||||||
|
Timed wait. Wait up to timeout_sec + timeout_nsec/1E9 seconds for the semaphore's count to exceed zero. If that happens, decrement the counter by one and return TRUE; otherwise, return FALSE. Definition at line 1127 of file ncbimtx.cpp. References SSemaphore::count, kMax_Int, m_Sem, and xncbi_Validate. Referenced by CGridWorkerNode::EnterExclusiveMode(), CBlockingQueue< TRequest >::GetHandle(), CThreadNonStop::Main(), CScheduler_ExecThread_Impl::Main(), CReadPipeThread::Main(), CWorkerNodeIdleThread::Main(), CBlockingQueue< TRequest >::Put(), CGridCleanupThread::Wait(), CGridWorkerNode::WaitForExclusiveJobToFinish(), CNCBlobStorage::x_DoBackgroundWork(), CNCMMCentral::x_DoBackgroundWork(), CNCBlobStorage::x_GC_CleanDBVolume(), CSyncQueue< Type, Container >::x_Lock(), CThreadPool_Impl::x_WaitForPredicate(), and CBlockingQueue< TRequest >::x_WaitForPredicate(). |
|
|
Wait on semaphore. Decrement the counter by one. If the semaphore's count is zero then wait until it's not zero. Definition at line 1079 of file ncbimtx.cpp. References SSemaphore::count, m_Sem, and xncbi_Validate. Referenced by CNCFileSystem::WriteToFile(), CReader::x_AllocConnection(), CThreadPool_ThreadImpl::x_Idle(), CSyncQueue< Type, Container >::x_Lock(), CThreadPool_ServiceThread::x_WaitForPoolStop(), and CThreadPool_Impl::x_WaitForPredicate(). |
|
|
System-specific semaphore data.
Definition at line 1338 of file ncbimtx.hpp. Referenced by CSemaphore(), Post(), TryWait(), Wait(), and ~CSemaphore(). |
1.4.6
Modified on Mon Dec 07 16:23:55 2009 by modify_doxy.py rev. 173732