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 "kernel/Globals.h"
Logger KeyEventListener::log("KEvLis");
void KeyEventListener::trigger(char c) {
this->lastChar = c;
}
char KeyEventListener::waitForKeyEvent() const {
log << DEBUG << "Thread with id: " << tid << " waiting for key event" << endl;
scheduler.block();
return this->lastChar; // This is only executed after thread is woken up by manager
}

View File

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

View File

@ -6,6 +6,7 @@
#include "user/lib/Vector.h"
// 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 {
private: