Expand description
A module containing easier to use thread-safe types for the creation of larger thread safe systems.
§Included Types
SyncCell
- A replacement forstd::cell::RefCell
andstd::cell::Cell
with an easier to use API thanstd::sync::RwLock
.HeldSyncCell
- A cell that maintains a previous value until theupdate
method is called at which point any changes to the value are applied.
Structs§
- Held
Sync Cell - A cell that holds a value until any changes made are applied by use of the
update
method. Getting the value or obtaining a reference to the value in this cell will return the value immediately following the last call toupdate
. This allows for mutably altering a value while keeping a reference for a short amount of time to the old value. This is useful when you want a method in a structure to be able to modify the structure it is being called from such as when changing the scene in a game engine. - Sync
Cell - A mutable memory location that can be modified safely from multiple threads.
This structure is similar to
std::cell::Cell
orstd::cell::RefCell
while being thread-safe. It functions as a thin wrapper aroundstd::sync::RwLock
while assuming that poisoned locks indicate an unrecoverable error. This makes it more ergonomic to use thanRwLock
at the cost of some stability.