Skip to main content

Crate seq_lock

Crate seq_lock 

Source

Structs§

SeqLock
Declare an instance of SeqLock by supplying header([H]) and value([T]) types, which should be configured with C-style layout & alignment. The value T can optionally include the sequence param as its first field (HAS_INLINE_SEQUENCE). If you choose not to do that, SeqLock will place a u32 atomic sequence number in between the header and value, in a VMO, shifting the value payload by SEQUENCE_SIZE.

Enums§

WriteSize
Byte size to use when incrementally writing out T in [set_value()]. Determined by the params in T. Four -> write in u32 chunks. Eight -> write in u64 chunks, although the first 8 bytes may be two u32s (one of which is the sequence).

Traits§

SeqLockable
Types that are safe to be synchronized across address spaces using a Seqlock.

Functions§

atomic_fetch_add_u32_acq_rel
This performs an atomic fetch-add with Acquire and Release ordering of val to a 32-bit value at addr. Use this to update the u32 lock.
atomic_load_u32_acquire
Performs an atomic acquire (load, or read) of a u32 from addr. You can use this to read the sequence or lock value.
atomic_load_u64_acquire
Performs an atomic acquire (load, or read) of a u64 from addr.
atomic_store_u32_release
This performs an atomic store-release of a 32-bit value to addr. Use this if you have a u32 or your struct is align(4).
atomic_store_u64_release
This performs an atomic store-release of a 64-bit value to addr. Use this if you have a u64 or your struct is align(8).