Struct IntrGuard
Source pub struct IntrGuard {
flags: usize,
}
Expand description
中断保护器,基于 RAII 实现中断保护。
在创建时原子地禁用中断并保存之前的状态;
在销毁时自动恢复之前的中断状态。
不可重入 (即不能嵌套调用 IntrGuard::new())。
使用示例:
ⓘ{
let guard = IntrGuard::new(); }
原子地禁用中断并返回一个 IntrGuard 实例。
该实例在离开作用域时会自动恢复中断状态。
检查进入临界区前,中断是否处于启用状态。
返回值:中断是否处于启用状态
当 IntrGuard 离开作用域时,自动恢复中断状态。
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
[From]<T> for U chooses to do.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.