#include <quantum_spinlock.h>
◆ Guard() [1/2]
SpinLock::Guard::Guard |
( |
SpinLock & |
lock | ) |
|
|
inlineexplicit |
Construct this object and lock the passed-in spinlock.
- Parameters
-
[in] | lock | Spinlock which protects a scope during the lifetime of the Guard. |
- Note
- Blocks the current thread until the spinlock is acquired.
◆ Guard() [2/2]
Construct this object and tries to lock the passed-in spinlock.
- Parameters
-
[in] | lock | Spinlock which protects a scope during the lifetime of the Guard. |
- Note
- Attempts to lock the spinlock. Does not block.
◆ ~Guard()
SpinLock::Guard::~Guard |
( |
| ) |
|
|
inline |
Destroy this object and unlock the underlying spinlock.
◆ lock()
void SpinLock::Guard::lock |
( |
| ) |
|
|
inline |
Acquire the underlying spinlock.
- Note
- Blocks.
◆ ownsLock()
bool SpinLock::Guard::ownsLock |
( |
| ) |
const |
|
inline |
Indicates if this object owns the underlying spinlock.
- Returns
- True if ownership is acquired.
◆ tryLock()
bool SpinLock::Guard::tryLock |
( |
| ) |
|
|
inline |
Try to acquire the underlying spinlock.
- Returns
- True if spinlock is locked, false otherwise.
- Note
- Does not block.