MADNESS  0.10.1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
madness::Spinlock Class Reference

Spinlock using pthread spinlock operations. More...

#include <worldmutex.h>

Inheritance diagram for madness::Spinlock:
Inheritance graph
[legend]

Public Member Functions

 Spinlock (int junk=0)
 Make and initialize a spinlock ... initial state is unlocked. More...
 
virtual ~Spinlock ()
 
void lock () const
 Acquire the spinlock waiting if necessary. More...
 
bool try_lock () const
 Try to acquire the spinlock ... return true on success, false on failure. More...
 
void unlock () const
 Free a spinlock owned by this thread. More...
 

Private Member Functions

 Spinlock (const Spinlock &)
 Copy constructor is forbidden. More...
 
void operator= (const Spinlock &)
 Assignment is forbidden. More...
 

Private Attributes

pthread_spinlock_t spinlock
 

Detailed Description

Spinlock using pthread spinlock operations.

Constructor & Destructor Documentation

◆ Spinlock() [1/2]

madness::Spinlock::Spinlock ( const Spinlock )
private

Copy constructor is forbidden.

◆ Spinlock() [2/2]

madness::Spinlock::Spinlock ( int  junk = 0)
inline

Make and initialize a spinlock ... initial state is unlocked.

References spinlock.

◆ ~Spinlock()

virtual madness::Spinlock::~Spinlock ( )
inlinevirtual

References spinlock.

Member Function Documentation

◆ lock()

void madness::Spinlock::lock ( ) const
inline

◆ operator=()

void madness::Spinlock::operator= ( const Spinlock )
private

Assignment is forbidden.

◆ try_lock()

bool madness::Spinlock::try_lock ( ) const
inline

Try to acquire the spinlock ... return true on success, false on failure.

References spinlock.

Referenced by madness::MutexReaderWriter::lock().

◆ unlock()

void madness::Spinlock::unlock ( ) const
inline

Member Data Documentation

◆ spinlock

pthread_spinlock_t madness::Spinlock::spinlock
mutableprivate

The documentation for this class was generated from the following file: