OpendTect  6.3
Public Member Functions | Protected Attributes | List of all members
Threads::SpinRWLock Class Reference

Is an alternative to ReadWriteLock. 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

 SpinRWLock ()
 
 SpinRWLock (const SpinRWLock &)
 
 ~SpinRWLock ()
 
void readLock ()
 
void readUnlock ()
 
void writeLock ()
 
void writeUnlock ()
 
int count () const
 

Protected Attributes

Atomic< int > count_
 

Detailed Description

Is an alternative to ReadWriteLock. 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.

Constructor & Destructor Documentation

Threads::SpinRWLock::SpinRWLock ( )
Threads::SpinRWLock::SpinRWLock ( const SpinRWLock )
Threads::SpinRWLock::~SpinRWLock ( )

Member Function Documentation

int Threads::SpinRWLock::count ( ) const
inline

Only for debugging.

void Threads::SpinRWLock::readLock ( )
void Threads::SpinRWLock::readUnlock ( )
void Threads::SpinRWLock::writeLock ( )
void Threads::SpinRWLock::writeUnlock ( )

Member Data Documentation

Atomic<int> Threads::SpinRWLock::count_
protected

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2017