summaryrefslogtreecommitdiff
path: root/kernel/source/input.cpp
blob: 696cb139e7e4bded9c24ae6f808603868b1ddc58 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <hilbert/kernel/application.hpp>
#include <hilbert/kernel/input.hpp>
#include <hilbert/kernel/panic.hpp>
#include <hilbert/kernel/vfile.hpp>

namespace hilbert::kernel::input {

  utility::queue<uint32_t> *key_queue;

  void init_input() {
    key_queue = new utility::queue<uint32_t>();
  }

  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);
    }
  }

}