Intel(R) Threading Building Blocks Doxygen Documentation
version 4.2.3
|
A lock that occupies a single byte. More...
#include <spin_mutex.h>
Classes | |
class | scoped_lock |
Represents acquisition of a mutex. More... | |
Public Member Functions | |
spin_mutex () | |
Construct unacquired lock. More... | |
void __TBB_EXPORTED_METHOD | internal_construct () |
Internal constructor with ITT instrumentation. More... | |
void | lock () |
Acquire lock. More... | |
bool | try_lock () |
Try acquiring lock (non-blocking) More... | |
void | unlock () |
Release lock. More... | |
Static Public Attributes | |
static const bool | is_rw_mutex = false |
static const bool | is_recursive_mutex = false |
static const bool | is_fair_mutex = false |
Private Attributes | |
__TBB_atomic_flag | flag |
0 if lock is released, 1 if lock is acquired. More... | |
Friends | |
class | scoped_lock |
A lock that occupies a single byte.
A spin_mutex is a spin mutex that fits in a single byte. It should be used only for locking short critical sections (typically less than 20 instructions) when fairness is not an issue. If zero-initialized, the mutex is considered unheld.
Definition at line 36 of file spin_mutex.h.
|
inline |
Construct unacquired lock.
Equivalent to zero-initialization of *this.
Definition at line 43 of file spin_mutex.h.
References internal_construct().
void tbb::spin_mutex::internal_construct | ( | ) |
Internal constructor with ITT instrumentation.
Definition at line 50 of file spin_mutex.cpp.
References _T, and ITT_SYNC_CREATE.
Referenced by spin_mutex(), and tbb::spin_mutex::scoped_lock::~scoped_lock().
|
inline |
Acquire lock.
Definition at line 144 of file spin_mutex.h.
References __TBB_LockByte(), tbb::aligned_space< T, N >::begin(), and tbb::spin_mutex::scoped_lock::scoped_lock().
|
inline |
Try acquiring lock (non-blocking)
Return true if lock acquired; false otherwise.
Definition at line 155 of file spin_mutex.h.
References __TBB_TryLockByte(), and tbb::aligned_space< T, N >::begin().
|
inline |
Release lock.
Definition at line 165 of file spin_mutex.h.
References __TBB_UnlockByte, tbb::aligned_space< T, N >::begin(), tbb::spin_mutex::scoped_lock::internal_release(), tbb::spin_mutex::scoped_lock::my_mutex, and s.
|
friend |
Definition at line 176 of file spin_mutex.h.
|
private |
0 if lock is released, 1 if lock is acquired.
Definition at line 38 of file spin_mutex.h.
Referenced by tbb::spin_mutex::scoped_lock::acquire(), tbb::spin_mutex::scoped_lock::internal_acquire(), tbb::spin_mutex::scoped_lock::internal_release(), tbb::spin_mutex::scoped_lock::internal_try_acquire(), tbb::spin_mutex::scoped_lock::release(), tbb::spin_mutex::scoped_lock::scoped_lock(), tbb::spin_mutex::scoped_lock::try_acquire(), and tbb::spin_mutex::scoped_lock::~scoped_lock().
|
static |
Definition at line 139 of file spin_mutex.h.
|
static |
Definition at line 138 of file spin_mutex.h.
|
static |
Definition at line 137 of file spin_mutex.h.