![]() |
OpendTect
6.3
|
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 () | |
| SpinLock & | operator= (const SpinLock &b) |
| void | lock () |
| void | unLock () |
| bool | tryLock () |
| int | count () const |
Protected Attributes | |
| Atomic< void * > | lockingthread_ |
| Atomic< int > | count_ |
| 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. 2017