1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-27 02:03:29 +04:00
rCore/kernel/src/process/mod.rs

21 lines
491 B
Rust
Raw Normal View History

use alloc::String;
2018-07-16 20:23:02 +04:00
pub use self::context::*;
2018-05-21 12:30:30 +04:00
pub use self::processor::*;
2018-06-03 19:05:43 +04:00
use spin::Once;
2018-07-16 20:23:02 +04:00
use sync::{SpinNoIrqLock, Mutex, MutexGuard, SpinNoIrq};
2018-07-16 20:23:02 +04:00
mod context;
mod processor;
2018-05-23 07:20:36 +04:00
mod scheduler;
2018-07-12 08:13:39 +04:00
pub fn init() {
2018-07-16 20:23:02 +04:00
PROCESSOR.call_once(||
SpinNoIrqLock::new(Processor::new(unsafe { Context::new_init() }))
);
}
2018-05-31 18:22:19 +04:00
pub static PROCESSOR: Once<SpinNoIrqLock<Processor>> = Once::new();
2018-07-16 20:23:02 +04:00
pub fn processor() -> MutexGuard<'static, Processor, SpinNoIrq> {
PROCESSOR.try().unwrap().lock()
}