gstd/sync/mod.rs
1// Copyright (C) Gear Technologies Inc.
2// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
3
4//! Data access synchronization objects.
5//!
6//! These synchronization objects are similar to those in the [`std::sync`](https://doc.rust-lang.org/std/sync/) module, but they prevent data races when dealing with multiple actors (users or programs) instead of multiple threads considered in classic synchronization objects.
7//!
8//! The following is an overview of the available synchronization objects:
9//!
10//! - [`Mutex`]: The Mutual Exclusion mechanism guarantees that during
11//! execution, only a single actor can access data at any given time.
12//! - [`RwLock`]: Provides a mutual exclusion mechanism that allows multiple
13//! readings by different actors while allowing only one writer at the
14//! execution. In some cases, this can be more efficient than a mutex.
15
16mod access;
17
18mod mutex;
19mod rwlock;
20
21pub use self::{
22 mutex::{Mutex, MutexGuard, MutexLockFuture},
23 rwlock::{RwLock, RwLockReadFuture, RwLockReadGuard, RwLockWriteFuture, RwLockWriteGuard},
24};
25
26pub(crate) use self::mutex::MutexId;