OpendTect
7.0
|
Is an alternative to Mutex. It is a lock which causes a thread trying to acquire it to simply wait in a loop ("spin") while repeatedly checking if the lock is available. Because they avoid overhead from operating system process re-scheduling or context switching, spinlocks are efficient if threads are only likely to be blocked for a short period. More...
Public Member Functions | |
SpinLock (bool recursive=false) | |
SpinLock (const SpinLock &) | |
~SpinLock () | |
int | count () const |
void | lock () |
SpinLock & | operator= (const SpinLock &b) |
bool | tryLock () |
void | unLock () |
Protected Attributes | |
Atomic< int > | count_ |
Atomic< void * > | lockingthread_ |
bool | recursive_ |
Is an alternative to Mutex. It is a lock which causes a thread trying to acquire it to simply wait in a loop ("spin") while repeatedly checking if the lock is available. Because they avoid overhead from operating system process re-scheduling or context switching, spinlocks are efficient if threads are only likely to be blocked for a short period.
<>
Threads::SpinLock::SpinLock | ( | bool | recursive = false | ) |
Threads::SpinLock::SpinLock | ( | const SpinLock & | ) |
Threads::SpinLock::~SpinLock | ( | ) |
|
inline |
Only for debugging.
void Threads::SpinLock::lock | ( | ) |
bool Threads::SpinLock::tryLock | ( | ) |
void Threads::SpinLock::unLock | ( | ) |
|
protected |
|
protected |
0 if unlocked, otherwise set to locking thread
|
protected |
Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024