From 2763e5d669ddf91f742d11f0b72a7fff3d7a5c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Wed, 8 Mar 2023 14:31:29 +0100 Subject: [PATCH] feat: add all-one-shot feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Kröning --- Cargo.toml | 3 +++ src/mutex/mod.rs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index fc61126..f9c3c48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,3 +19,6 @@ one-shot-mutex = "0.1.0" [dev-dependencies] rand = "0.8" + +[features] +all-one-shot = [] diff --git a/src/mutex/mod.rs b/src/mutex/mod.rs index ad2a39c..dcd0c88 100644 --- a/src/mutex/mod.rs +++ b/src/mutex/mod.rs @@ -1,5 +1,21 @@ +#[cfg(not(feature = "all-one-shot"))] pub(crate) mod spin; +#[cfg(feature = "all-one-shot")] +pub(crate) mod spin { + pub use one_shot_mutex::{ + OneShotMutex as SpinMutex, OneShotMutexGuard as SpinMutexGuard, + RawOneShotMutex as RawSpinMutex, + }; +} +#[cfg(not(feature = "all-one-shot"))] pub(crate) mod ticket; +#[cfg(feature = "all-one-shot")] +pub(crate) mod ticket { + pub use one_shot_mutex::{ + OneShotMutex as TicketMutex, OneShotMutexGuard as TicketMutexGuard, + RawOneShotMutex as RawTicketMutex, + }; +} use interrupt_mutex::RawInterruptMutex; use one_shot_mutex::RawOneShotMutex;