mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-14 20:26:48 +00:00
Raw spin lock 增加lock_irqsave、unlock_irqrestore(#151)
Raw spin lock 增加lock_irqsave、unlock_irqrestore
This commit is contained in:
parent
06b09f34ed
commit
d8a064128a
@ -127,10 +127,19 @@ impl RawSpinlock {
|
|||||||
self.0.store(value, Ordering::SeqCst);
|
self.0.store(value, Ordering::SeqCst);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: spin_lock_irqsave
|
/// @brief 保存中断状态到flags中,关闭中断,并对自旋锁加锁
|
||||||
// todo: spin_unlock_irqrestore
|
pub fn lock_irqsave(&self, flags: &mut u64) {
|
||||||
}
|
local_irq_save(flags);
|
||||||
|
self.lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @brief 恢复rflags以及中断状态并解锁自旋锁
|
||||||
|
pub fn unlock_irqrestore(&self, flags: &u64){
|
||||||
|
self.unlock();
|
||||||
|
local_irq_restore(flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
/// 实现了守卫的SpinLock, 能够支持内部可变性
|
/// 实现了守卫的SpinLock, 能够支持内部可变性
|
||||||
///
|
///
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user