<
classTLockVect>
106 unsignedtimeout_ms);
120 unsignedtimeout_ms);
169 template<
classTLockVect>
172: m_LockVector(&lvect),
174m_Timeout(timeout_ms),
181 template<
classTLockVect>
185: m_LockVector(&lvect),
187m_Timeout(timeout_ms),
195 template<
classTLockVect>
201 catch(exception& ex)
207 template<
classTLockVect>
217 for(
unsigned i= 0;
i< m_Spins; ++
i) {
218m_LockSet = m_LockVector->TryLock(m_Id);
226 unsignedsleep_ms = 10;
227 unsignedtime_spent = 0;
229m_LockSet = m_LockVector->TryLock(m_Id);
235time_spent += sleep_ms;
236 if(time_spent > m_Timeout) {
237 string msg=
"Lock vector timeout error on object id=" 246 template<
classTLockVect>
254 template<
classTLockVect>
260 boolunlocked = m_LockVector->Unlock(m_Id);
274m_LockVector =
lg.m_LockVector; m_Id =
lg.m_Id;
289 if(m_IdVector.any()) {
291 "::~CLockVector() detected live locks on destruction.");
299 boolis_set = m_IdVector.set_bit_conditional(
id,
true,
false);
307 boolis_set = m_IdVector.set_bit_conditional(
id,
false,
true);
309 _ASSERT(m_IdVector[
id] ==
false);
318m_IdVector.optimize(0, TBitVector::opt_free_0);
325 returnm_IdVector[id];
Lock guard for the CLockVector.
Class implements bit-vector based lock storage registering millions of int numbered objects.
#define ERR_POST_XX(error_name, err_subcode, message)
Error posting with error code having given name and with given error subcode.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
TLockVector * m_LockVector
bool TryLock(unsigned id)
Try to acquire lock of specified id.
void TakeFrom(CLockVectorGuard &lg)
Transfer lock ownership from another lock.
CLockVectorGuard(TLockVector &lvect, unsigned id, unsigned timeout_ms)
Construct and lock.
void Release()
Forger lock.
TBitVector m_IdVector
vector of locked objs
unsigned GetTimeout() const
void FreeUnusedMem()
Reclaim unused memory.
void Lock(unsigned id)
Acquire lock.
CLockVectorGuard< TLockVect > & operator=(const CLockVectorGuard< TLockVect > &)
unsigned GetId() const
Get BLOB id.
CFastMutex m_IdVector_Lock
lock for m_LockVector
TLockVector & GetLockVector() const
CLockVectorGuard(TLockVector &lvect, unsigned timeout_ms)
Construct without locking.
bool IsLocked(unsigned id) const
Check if id is locked or not.
void Unlock()
Unlocks the lock.
CLockVectorGuard(const CLockVectorGuard< TLockVect > &)
bool Unlock(unsigned id)
Unlock object.
void SetId(unsigned id)
Assign Id (no locking)
void DoLock()
Lock acquisition.
CLockVector & operator=(const CLockVector< BV > &)
CLockVector(const CLockVector< BV > &)
@ BM_GAP
GAP compression is ON.
Definition of all error codes used in util (xutil.lib).
Compressed bitset (entry point to bm.h)
void SleepMilliSec(unsigned long ml_sec, EInterruptOnSignal onsignal=eRestartOnSignal)
Miscellaneous common-use basic types and functionality.
Multi-threading â mutexes; rw-locks; semaphore.
static SLJIT_INLINE sljit_ins lg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4