forked from AbleOS/ableos
Added interrupt lookup to executor
This commit is contained in:
parent
2b33a65e6b
commit
f65a5bd79c
|
@ -1,5 +1,5 @@
|
||||||
use {
|
use {
|
||||||
alloc::{boxed::Box, sync::Arc},
|
alloc::{boxed::Box, sync::Arc, vec::Vec},
|
||||||
core::{
|
core::{
|
||||||
future::Future,
|
future::Future,
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
|
@ -35,6 +35,7 @@ impl<T: Future<Output = ()> + Send> Process for T {}
|
||||||
pub struct Executor {
|
pub struct Executor {
|
||||||
tasks: Slab<Task>,
|
tasks: Slab<Task>,
|
||||||
task_queue: Arc<SegQueue<usize>>,
|
task_queue: Arc<SegQueue<usize>>,
|
||||||
|
interrupt_lookup: [Option<usize>; u8::MAX as usize],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Executor {
|
impl Executor {
|
||||||
|
@ -42,6 +43,7 @@ impl Executor {
|
||||||
Self {
|
Self {
|
||||||
tasks: Slab::new(),
|
tasks: Slab::new(),
|
||||||
task_queue: Arc::new(SegQueue::new()),
|
task_queue: Arc::new(SegQueue::new()),
|
||||||
|
interrupt_lookup: [None; u8::MAX as usize],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +100,14 @@ impl Executor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn send_interrupt(&self, interrupt : u8){
|
||||||
|
let id = self.interrupt_lookup[interrupt as usize];
|
||||||
|
if let Some(id) = id{
|
||||||
|
let task = &self.tasks[id];
|
||||||
|
task.set_paused(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Task {
|
struct Task {
|
||||||
|
|
Loading…
Reference in a new issue