CppCommon
1.0.4.1
C++ Common Library
|
Sequential lock synchronization primitive. More...
#include <seq_lock.h>
Public Member Functions | |
SeqLock () | |
SeqLock (const T &data) | |
SeqLock (const SeqLock &)=delete | |
SeqLock (SeqLock &&)=default | |
~SeqLock ()=default | |
SeqLock & | operator= (const T &data) noexcept |
SeqLock & | operator= (const SeqLock &)=delete |
SeqLock & | operator= (SeqLock &&)=delete |
T | Read () const noexcept |
Read data under the sequential lock. More... | |
void | Write (const T &data) noexcept |
Write data under the sequential lock. More... | |
Sequential lock synchronization primitive.
Sequential locks are an important synchronization mechanism and represent a significant improvement over conventional read/write locks in some contexts. They avoid the need to update a synchronization variable during a reader critical section, and hence improve performance by avoiding cache coherence misses on the lock object itself.
Thread-safe.
https://en.wikipedia.org/wiki/Seqlock
Definition at line 30 of file seq_lock.h.
|
inline |
Definition at line 12 of file seq_lock.inl.
|
inlineexplicit |
Definition at line 19 of file seq_lock.inl.
|
delete |
|
default |
|
default |
|
delete |
|
inlinenoexcept |
Definition at line 25 of file seq_lock.inl.
|
delete |
|
inlinenoexcept |
Read data under the sequential lock.
Will block in a spin loop.
Definition at line 32 of file seq_lock.inl.
|
inlinenoexcept |
Write data under the sequential lock.
Will not block.
data | - Data to write |
Definition at line 51 of file seq_lock.inl.