From 9af5588c30c4126a2800aae1afcb0de2c373dc6c Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Mon, 20 May 2024 17:40:47 -0400 Subject: rewrite application stuff in the kernel to support multitasking --- kernel/source/input.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'kernel/source/input.cpp') diff --git a/kernel/source/input.cpp b/kernel/source/input.cpp index 921ae7b..4f12e6e 100644 --- a/kernel/source/input.cpp +++ b/kernel/source/input.cpp @@ -6,17 +6,16 @@ namespace hilbert::kernel::input { utility::queue *input_queue; + utility::queue *waiting_for_input; - void init_input() { - input_queue = new utility::queue(); + void notify_waiting() { + if (waiting_for_input->count > 0) + application::paused_threads->insert(waiting_for_input->take()); } - void got_input() { - if (application::threads_waiting_for_input->count > 0) { - auto *t = application::threads_waiting_for_input->take(); - t->state = application::thread_state::paused; - application::paused_threads->insert(t); - } + void init_input() { + input_queue = new utility::queue(); + waiting_for_input = new utility::queue(); } } -- cgit v1.2.3