mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-08 12:56:48 +00:00
Add InAtomicMode: Debug
This commit is contained in:
parent
3472560c55
commit
ef81100958
@ -50,17 +50,17 @@ pub fn might_sleep() {
|
||||
///
|
||||
/// Key kernel primitives such as `SpinLock` and `Rcu` rely on
|
||||
/// [the atomic mode](crate::task::atomic_mode) for correctness or soundness.
|
||||
/// The existence of such a guard guarantees that
|
||||
/// the current task is executing in the atomic mode.
|
||||
/// The existence of such a guard guarantees that the current task is executing
|
||||
/// in the atomic mode.
|
||||
///
|
||||
/// It requires [`core::fmt::Debug`] by default to make it easier to derive
|
||||
/// [`Debug`] for types with `&dyn InAtomicMode`.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// The implementer must ensure that the atomic mode is maintained while
|
||||
/// the guard type is alive.
|
||||
///
|
||||
/// [`DisabledLocalIrqGuard`]: crate::task::DisabledPreemptGuard
|
||||
/// [`DisabledPreemptGuard`]: crate::trap::DisabledLocalIrqGuard
|
||||
pub unsafe trait InAtomicMode {}
|
||||
pub unsafe trait InAtomicMode: core::fmt::Debug {}
|
||||
|
||||
/// Abstracts any type from which one can obtain a reference to an atomic-mode guard.
|
||||
pub trait AsAtomicModeGuard {
|
||||
|
@ -139,6 +139,7 @@ pub fn disable_local() -> DisabledLocalIrqGuard {
|
||||
/// A guard for disabled local IRQs.
|
||||
#[clippy::has_significant_drop]
|
||||
#[must_use]
|
||||
#[derive(Debug)]
|
||||
pub struct DisabledLocalIrqGuard {
|
||||
was_enabled: bool,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user