pub mod arceos {
pub use ax_api as api;
pub mod guard {
pub use ax_runtime::task::sync::{IrqSaveGuard, PreemptGuard, PreemptIrqSaveGuard};
}
#[doc(no_inline)]
pub use ax_api::modules;
#[doc(no_inline)]
pub use ax_driver as driver;
#[doc(no_inline)]
pub use ax_percpu as percpu;
pub mod sync {
pub use ax_runtime::task::sync::*;
#[repr(transparent)]
pub struct IrqSafeMutex<T: ?Sized>(ax_runtime::task::sync::RawSpinLock<T>);
impl<T> IrqSafeMutex<T> {
#[track_caller]
pub const fn new(value: T) -> Self {
Self(ax_runtime::task::sync::RawSpinLock::new(value))
}
#[track_caller]
pub fn lock(&self) -> IrqSafeMutexGuard<'_, T> {
self.0.lock_irqsave()
}
#[track_caller]
pub fn try_lock(&self) -> Option<IrqSafeMutexGuard<'_, T>> {
self.0.try_lock_irqsave()
}
}
impl<T: Default> Default for IrqSafeMutex<T> {
fn default() -> Self {
Self::new(T::default())
}
}
impl<T: core::fmt::Debug> core::fmt::Debug for IrqSafeMutex<T> {
fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
self.0.fmt(formatter)
}
}
pub type IrqSafeMutexGuard<'a, T> = ax_runtime::task::sync::RawSpinLockIrqSaveGuard<'a, T>;
pub type NoPreemptMutex<T> = ax_runtime::task::sync::RawSpinLock<T>;
pub type NoPreemptMutexGuard<'a, T> = ax_runtime::task::sync::RawSpinLockGuard<'a, T>;
}
pub use ax_runtime::{diagnostics, irq, task, thread};
}
#[cfg(feature = "std-compat")]
pub mod libc_compat;
#[cfg(any(feature = "std-compat", all(test, feature = "host-test")))]
mod futex;