mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-28 17:13:23 +00:00
新增rust版本的lockref (#135)
* new:Rust封装cpu_relax(),通过pause指令,让cpu休息一会儿。降低空转功耗 * new: Rust版本的lockref * Rust的RawSpinlock新增is_locked()和set_value()方法。 * lockref文档
This commit is contained in:
@ -14,3 +14,10 @@ pub fn arch_current_apic_id() -> u8 {
|
||||
}
|
||||
return (cpuid_res >> 24) as u8;
|
||||
}
|
||||
|
||||
/// @brief 通过pause指令,让cpu休息一会儿。降低空转功耗
|
||||
pub fn cpu_relax() {
|
||||
unsafe {
|
||||
asm!("pause");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user