Skip to main content

ax_task/sync/
mod.rs

1//! Scheduler-owned locks, wait queues and IRQ waiting.
2//!
3//! Runtime providers use [`crate::runtime::sync`] for PI, blocking and lockdep
4//! capabilities. The bridge shares the scheduler's waiters, donation graph
5//! and wakeup state.
6
7#[doc(hidden)]
8pub(crate) mod bridge;
9mod context;
10mod migration;
11pub use migration::MigrationGuard;
12mod local_lock;
13#[cfg(feature = "lockdep")]
14pub(crate) mod lockdep;
15pub(crate) mod mutex;
16mod rt_rwlock;
17mod rt_spin;
18mod rwsem;
19mod semaphore;
20#[cfg(feature = "fault-injection")]
21pub use semaphore::fail_next_semaphore_timer_registration;
22pub use semaphore::{Semaphore, SemaphoreError};
23mod spin;
24pub use local_lock::{LocalLock, LocalLockGuard};
25pub use rt_rwlock::{SpinRwLock, SpinRwLockReadGuard, SpinRwLockWriteGuard};
26use rt_spin::RtCriticalGuard;
27pub use rt_spin::{SpinLock, SpinLockGuard};
28pub use rwsem::{RawRwSemaphore, RwSemaphore, RwSemaphoreReadGuard, RwSemaphoreWriteGuard};
29#[cfg(feature = "lockdep")]
30pub use {
31    self::lockdep::LockSubclass, self::lockdep::dump_lockdep_trace,
32    self::lockdep::set_lockdep_trace_enabled,
33};
34
35pub use self::mutex::{
36    InterruptibleMutexExt, LockdepMutexExt, Mutex, MutexGuard, PiMutexLockInterrupted, RawMutex,
37};
38#[cfg(not(feature = "lockdep"))]
39pub type LockSubclass = u32;
40#[cfg(not(feature = "lockdep"))]
41pub const fn set_lockdep_trace_enabled(_enabled: bool) {}
42#[cfg(not(feature = "lockdep"))]
43pub const fn dump_lockdep_trace() {}
44
45pub use self::context::{
46    IrqReturnPreemptGuard, IrqSaveGuard, PreemptGuard, PreemptIrqSaveGuard, hardirq_enter,
47    hardirq_exit,
48};
49pub use crate::sync::spin::{
50    RawIrqSaveMutex, RawSpinLock, RawSpinLockGuard, RawSpinLockIrqSaveGuard,
51    RawSpinLockUnpinnedGuard, RawSpinRwLock, RawSpinRwLockIrqSaveReadGuard,
52    RawSpinRwLockIrqSaveWriteGuard, RawSpinRwLockReadGuard, RawSpinRwLockUnpinnedReadGuard,
53    RawSpinRwLockUnpinnedWriteGuard, RawSpinRwLockWriteGuard,
54};
55
56/// A non-sleeping mutex whose guard saves and disables local IRQs.
57pub type IrqMutex<T> = lock_api::Mutex<RawIrqSaveMutex, T>;
58
59pub use crate::sync::wait_queue::{
60    WaitQueue, WaitQueueRegistration, WaitQueueWakeOutcome, WaitQueueWakeToken,
61    wait_until_registered,
62};
63
64pub mod irq;
65
66pub mod membarrier;
67
68pub(crate) mod wait_queue;