xref: /DragonOS/kernel/src/process/utils.rs (revision b5b571e02693d91eb6918d3b7561e088c3e7ee81)
1 use crate::process::ProcessManager;
2 
3 use super::{ProcessFlags, __PROCESS_MANAGEMENT_INIT_DONE};
4 
current_pcb_flags() -> ProcessFlags5 pub fn current_pcb_flags() -> ProcessFlags {
6     if unsafe { !__PROCESS_MANAGEMENT_INIT_DONE } {
7         return ProcessFlags::empty();
8     }
9     return *ProcessManager::current_pcb().flags();
10 }
11 
current_pcb_preempt_count() -> usize12 pub fn current_pcb_preempt_count() -> usize {
13     if unsafe { !__PROCESS_MANAGEMENT_INIT_DONE } {
14         return 0;
15     }
16     return ProcessManager::current_pcb().preempt_count();
17 }
18