|
Zero
0.1.0
|
A test-and-test-and-set spinlock. More...
#include <tatas.h>
Public Member Functions | |
| tatas_lock () | |
| bool | try_lock () |
| Try to acquire the lock immediately. More... | |
| void | acquire () |
| Acquire the lock, spinning as long as necessary. More... | |
| void | release () |
| Release the lock. More... | |
| bool | is_mine () const |
| True if this thread is the lock holder. More... | |
Private Member Functions | |
| void | spin () |
| spin until lock is free More... | |
A test-and-test-and-set spinlock.
This lock is good for short, uncontended critical sections. If contention is high, use an mcs_lock. Long critical sections should use pthread_mutex_t.
Tradeoffs are:
|
inline |
skip
|
inline |
Acquire the lock, spinning as long as necessary.
|
inline |
True if this thread is the lock holder.
|
inline |
Release the lock.
|
inlineprivate |
spin until lock is free
|
inline |
Try to acquire the lock immediately.
1.8.12