#async #os #reference-data

no-std lilos-rwlock

A read-write / writer-preferred lock for use with lilos

2 unstable releases

0.2.0 May 5, 2024
0.1.0 Apr 29, 2024

#1577 in Embedded development

MPL-2.0 license

230KB
2.5K SLoC

Read-write lock for lilos

This provides a read-write lock for use with lilos.

See the API documentation for more.


lib.rs:

A read-write lock for use with lilos.

There's a small family of related types in this here crate:

  • RwLock<T> contains some data of type T and allows either multiple shared references, or one exclusive reference, but not both simultaneously.
  • SharedGuard<T> represents a shared reference to the data guarded by a RwLock and allows access to it (via Deref).
  • ActionPermit<T> represents an exclusive reference to the data guarded by a RwLock, but once you start doing something that can modify the data, you can't await, to ensure that cancellation won't corrupt the guarded data.
  • ExclusiveGuard<T> allows arbitrary exclusive access, even across await points, but you have to promise the library that the data is inherently cancel-safe (by using the lilos::util::CancelSafe marker type).

See the docs on RwLock for more details.

Dependencies

~2.5MB
~40K SLoC