A simple wrapper around a Spinlock object that implements the timed lockable concept such that attempts to lock an already locked Spinlock will always yield before trying again.
More...
#include <Spinlock.hpp>
A simple wrapper around a Spinlock object that implements the timed lockable concept such that attempts to lock an already locked Spinlock will always yield before trying again.
This is useful in cases where a spinlock gives better performance a majority of the time, but seldom occuring longer delays are possible. This class can be used when those longer delays are known to occur to mitigate the performance issues of a spinlock. While functions for yielding exist on Spinlock, this class calls them from the lockable concept functions so that other classes like std::condition_variable_any can yield between lock attempts.
- Author
- Jeff Jackowski
Definition at line 245 of file Spinlock.hpp.
◆ SpinlockYieldingWrapper()
| duds::general::SpinlockYieldingWrapper::SpinlockYieldingWrapper |
( |
Spinlock & |
l | ) |
|
|
inline |
◆ lock()
| void duds::general::SpinlockYieldingWrapper::lock |
( |
| ) |
|
|
inline |
◆ try_lock()
| bool duds::general::SpinlockYieldingWrapper::try_lock |
( |
| ) |
|
|
inline |
◆ try_lock_for()
template<class Rep , class Period >
| bool duds::general::SpinlockYieldingWrapper::try_lock_for |
( |
const std::chrono::duration< Rep, Period > & |
duration | ) |
|
|
inline |
◆ try_lock_until()
template<class Clock , class Duration >
| bool duds::general::SpinlockYieldingWrapper::try_lock_until |
( |
const std::chrono::time_point< Clock, Duration > & |
time | ) |
|
|
inline |
◆ unlock()
| void duds::general::SpinlockYieldingWrapper::unlock |
( |
| ) |
|
|
inline |
◆ sl
| Spinlock& duds::general::SpinlockYieldingWrapper::sl |
|
private |
The documentation for this class was generated from the following file: