summaryrefslogtreecommitdiff
path: root/kernel/source/input.cpp
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-05-20 17:40:47 -0400
committerBenji Dial <benji@benjidial.net>2024-05-20 17:40:47 -0400
commit9af5588c30c4126a2800aae1afcb0de2c373dc6c (patch)
treed2a48a97b1664f958b5f88a8b0c03ef8366b0f49 /kernel/source/input.cpp
parent5a54df93c4e9368c36e69d1e9c88cd2904e92308 (diff)
downloadhilbert-os-9af5588c30c4126a2800aae1afcb0de2c373dc6c.tar.gz
rewrite application stuff in the kernel to support multitasking
Diffstat (limited to 'kernel/source/input.cpp')
-rw-r--r--kernel/source/input.cpp15
1 files changed, 7 insertions, 8 deletions
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_packet> *input_queue;
+ utility::queue<application::thread *> *waiting_for_input;
- void init_input() {
- input_queue = new utility::queue<input_packet>();
+ 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<input_packet>();
+ waiting_for_input = new utility::queue<application::thread *>();
}
}