axsync/lib.rs
1//! [ArceOS](https://github.com/arceos-org/arceos) synchronization primitives.
2//!
3//! Currently supported primitives:
4//!
5//! - [`Mutex`]: A mutual exclusion primitive.
6//! - mod [`spin`]: spinlocks imported from the [`kspin`] crate.
7//!
8//! # Cargo Features
9//!
10//! - `multitask`: For use in the multi-threaded environments. If the feature is
11//! not enabled, [`Mutex`] will be an alias of [`spin::SpinNoIrq`]. This
12//! feature is enabled by default.
13
14#![cfg_attr(not(test), no_std)]
15#![feature(doc_cfg)]
16
17pub use kspin as spin;
18
19#[cfg(feature = "multitask")]
20mod mutex;
21
22#[cfg(feature = "multitask")]
23#[doc(cfg(feature = "multitask"))]
24pub use self::mutex::{Mutex, MutexGuard};
25
26#[cfg(not(feature = "multitask"))]
27#[doc(cfg(not(feature = "multitask")))]
28pub use kspin::{SpinNoIrq as Mutex, SpinNoIrqGuard as MutexGuard};