OpendTect  6.6
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 ()
 
int count () const
 
void readLock ()
 
void readUnlock ()
 
void writeLock ()
 
void writeUnlock ()
 

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

◆ SpinRWLock() [1/2]

Threads::SpinRWLock::SpinRWLock ( )

◆ SpinRWLock() [2/2]

Threads::SpinRWLock::SpinRWLock ( const SpinRWLock )

◆ ~SpinRWLock()

Threads::SpinRWLock::~SpinRWLock ( )

Member Function Documentation

◆ count()

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

Only for debugging.

◆ readLock()

void Threads::SpinRWLock::readLock ( )

◆ readUnlock()

void Threads::SpinRWLock::readUnlock ( )

◆ writeLock()

void Threads::SpinRWLock::writeLock ( )

◆ writeUnlock()

void Threads::SpinRWLock::writeUnlock ( )

Member Data Documentation

◆ count_

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

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