libMesh::Threads::spin_mutex Class Reference

#include <threads_none.h>

Classes

class  scoped_lock
 

Public Member Functions

 spin_mutex ()
 
void lock ()
 
void unlock ()
 
 spin_mutex ()
 
 ~spin_mutex ()
 
void lock ()
 
void unlock ()
 
 spin_mutex ()
 
 ~spin_mutex ()
 
void lock ()
 
void unlock ()
 
 spin_mutex ()
 
 ~spin_mutex ()
 
void lock ()
 
void unlock ()
 

Private Attributes

os_unfair_lock ulock
 
OSSpinLock slock
 
pthread_spinlock_t slock
 

Detailed Description

Spin mutex. Implements mutual exclusion by busy-waiting in user space for the lock to be acquired.

Definition at line 127 of file threads_none.h.

Constructor & Destructor Documentation

libMesh::Threads::spin_mutex::spin_mutex ( )
inline

Definition at line 130 of file threads_none.h.

130 {}
libMesh::Threads::spin_mutex::spin_mutex ( )
inline

Definition at line 88 of file threads_pthread.h.

References ulock.

88 { ulock = OS_UNFAIR_LOCK_INIT; }
libMesh::Threads::spin_mutex::~spin_mutex ( )
inline

Definition at line 89 of file threads_pthread.h.

89 {}
libMesh::Threads::spin_mutex::spin_mutex ( )
inline

Definition at line 116 of file threads_pthread.h.

116 : slock(0) {} // The convention is that the lock being zero is _unlocked_
libMesh::Threads::spin_mutex::~spin_mutex ( )
inline

Definition at line 117 of file threads_pthread.h.

117 {}
libMesh::Threads::spin_mutex::spin_mutex ( )
inline

Definition at line 146 of file threads_pthread.h.

References slock.

146 { pthread_spin_init(&slock, PTHREAD_PROCESS_PRIVATE); }
libMesh::Threads::spin_mutex::~spin_mutex ( )
inline

Definition at line 147 of file threads_pthread.h.

References slock.

147 { pthread_spin_destroy(&slock); }

Member Function Documentation

void libMesh::Threads::spin_mutex::lock ( )
inline

Definition at line 91 of file threads_pthread.h.

References ulock.

91 { os_unfair_lock_lock(&ulock); }
void libMesh::Threads::spin_mutex::lock ( )
inline

Definition at line 119 of file threads_pthread.h.

References slock.

119 { OSSpinLockLock(&slock); }
void libMesh::Threads::spin_mutex::lock ( )
inline

Definition at line 149 of file threads_pthread.h.

References slock.

149 { pthread_spin_lock(&slock); }
void libMesh::Threads::spin_mutex::unlock ( )
inline

Definition at line 92 of file threads_pthread.h.

References ulock.

92 { os_unfair_lock_unlock(&ulock); }
void libMesh::Threads::spin_mutex::unlock ( )
inline

Definition at line 120 of file threads_pthread.h.

References slock.

120 { OSSpinLockUnlock(&slock); }
void libMesh::Threads::spin_mutex::unlock ( )
inline

Definition at line 132 of file threads_none.h.

Referenced by libMesh::Threads::spin_mutex::scoped_lock::release().

132 {}
void libMesh::Threads::spin_mutex::unlock ( )
inline

Definition at line 150 of file threads_pthread.h.

References slock.

150 { pthread_spin_unlock(&slock); }

Member Data Documentation

OSSpinLock libMesh::Threads::spin_mutex::slock
private

Definition at line 138 of file threads_pthread.h.

Referenced by lock(), spin_mutex(), unlock(), and ~spin_mutex().

pthread_spinlock_t libMesh::Threads::spin_mutex::slock
private

Definition at line 168 of file threads_pthread.h.

os_unfair_lock libMesh::Threads::spin_mutex::ulock
private

Definition at line 110 of file threads_pthread.h.

Referenced by lock(), spin_mutex(), and unlock().


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