Rm spin::Mutex except for easy-fs & add new test huge_write & flush cache to disk after a write transaction
This commit is contained in:
parent
569e2fe2fe
commit
b8a14182cd
36 changed files with 339 additions and 229 deletions
|
@ -1,7 +1,7 @@
|
|||
use crate::sync::UPSafeCell;
|
||||
use super::TaskControlBlock;
|
||||
use alloc::collections::VecDeque;
|
||||
use alloc::sync::Arc;
|
||||
use spin::Mutex;
|
||||
use lazy_static::*;
|
||||
|
||||
pub struct TaskManager {
|
||||
|
@ -22,13 +22,15 @@ impl TaskManager {
|
|||
}
|
||||
|
||||
lazy_static! {
|
||||
pub static ref TASK_MANAGER: Mutex<TaskManager> = Mutex::new(TaskManager::new());
|
||||
pub static ref TASK_MANAGER: UPSafeCell<TaskManager> = unsafe {
|
||||
UPSafeCell::new(TaskManager::new())
|
||||
};
|
||||
}
|
||||
|
||||
pub fn add_task(task: Arc<TaskControlBlock>) {
|
||||
TASK_MANAGER.lock().add(task);
|
||||
TASK_MANAGER.exclusive_access().add(task);
|
||||
}
|
||||
|
||||
pub fn fetch_task() -> Option<Arc<TaskControlBlock>> {
|
||||
TASK_MANAGER.lock().fetch()
|
||||
TASK_MANAGER.exclusive_access().fetch()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue