aboutsummaryrefslogtreecommitdiff
path: root/TUI/module.jai
diff options
context:
space:
mode:
Diffstat (limited to 'TUI/module.jai')
-rw-r--r--TUI/module.jai19
1 files changed, 3 insertions, 16 deletions
diff --git a/TUI/module.jai b/TUI/module.jai
index 7a7dc54..c1f40ce 100644
--- a/TUI/module.jai
+++ b/TUI/module.jai
@@ -98,19 +98,10 @@ Keys :: enum u8 {
Resize :: 1; //410; // TODO Why?!
}
-input_semaphore: Semaphore;
key_semaphore: Semaphore;
key_mutex: Mutex;
key_input := Keys.None;
key_resize := Keys.None;
-// key_queue: [2] Key; // TODO Queue with size 1!? hmmm nice!
-// key_queue_idx := 0;
-
-
-
-// queue_semaphore: Semaphore;
-// queue_mutex: Mutex;
-// queue :: Keys;
// Notes
// So, the semaphore usage should indicate the items on the key_queue.
@@ -126,9 +117,9 @@ process_input :: (thread: *Thread) -> s64 {
defer dam(">STOP signal_input\n");
while(true) {
if initialized == false return 0;
- if key_input != Keys.None { // TODO Reading without mutex...
+ if key_input != Keys.None {
dam("waiting..");
- sleep_milliseconds(100);
+ sleep_milliseconds(100); // We could increase this value as a push-back mechanism if we're just hitting it repeateadly.
dam("!\n\r");
continue;
}
@@ -170,7 +161,7 @@ get_key :: (wait_milliseconds: s32) -> Key {
defer key_resize = Keys.None;
return xx key_resize;
}
-
+
defer key_input = Keys.None;
return xx key_input;
}
@@ -186,7 +177,6 @@ dam("B");
init(*input_buffer_mutex, "input_buffer_mutex");
assert(thread_init(*input_process_thread, process_input), "Failed to initialize thread.");
dam("C");
- // init(*input_semaphore);
init(*key_semaphore);
init(*key_mutex, "key_mutex");
dam("D");
@@ -199,10 +189,7 @@ stop :: () {
if initialized == false return;
initialized = false;
- // signal(*input_semaphore); // TODO Maybe use tcflush ???
thread_deinit(*input_process_thread);
-
- // destroy(*input_semaphore);
destroy(*key_semaphore);
OS_reset_terminal();