1

log keyeventlistener

This commit is contained in:
2022-07-22 02:35:18 +02:00
parent 2021788831
commit 01e15f484e
3 changed files with 6 additions and 0 deletions

View File

@ -1,11 +1,14 @@
#include "user/event/KeyEventListener.h" #include "user/event/KeyEventListener.h"
#include "kernel/Globals.h" #include "kernel/Globals.h"
Logger KeyEventListener::log("KEvLis");
void KeyEventListener::trigger(char c) { void KeyEventListener::trigger(char c) {
this->lastChar = c; this->lastChar = c;
} }
char KeyEventListener::waitForKeyEvent() const { char KeyEventListener::waitForKeyEvent() const {
log << DEBUG << "Thread with id: " << tid << " waiting for key event" << endl;
scheduler.block(); scheduler.block();
return this->lastChar; // This is only executed after thread is woken up by manager return this->lastChar; // This is only executed after thread is woken up by manager
} }

View File

@ -7,6 +7,8 @@ class KeyEventListener {
private: private:
KeyEventListener(const KeyEventListener& copy) = delete; KeyEventListener(const KeyEventListener& copy) = delete;
static Logger log;
char lastChar = '\0'; char lastChar = '\0';
public: public:

View File

@ -6,6 +6,7 @@
#include "user/lib/Vector.h" #include "user/lib/Vector.h"
// NOTE: Could do this more generally but we only have key events // NOTE: Could do this more generally but we only have key events
// Also pretty limited: One thread can have one listener as identification is done over tid
class KeyEventManager { class KeyEventManager {
private: private: