1
Files
churlos/src/lib/demo/KeyboardDemo.h
2022-12-08 17:13:34 +01:00

46 lines
1.7 KiB
C++
Executable File

/*****************************************************************************
* *
* K E Y B O A R D D E M O *
* *
*---------------------------------------------------------------------------*
* Beschreibung: Testausgaben für den CGA-Treiber. *
* *
* Autor: Michael Schoettner, HHU, 26.10.2018 *
*****************************************************************************/
#ifndef KeyboardDemo_include__
#define KeyboardDemo_include__
#include "kernel/system/Globals.h"
#include "kernel/process/Thread.h"
#include "kernel/event/KeyEventListener.h"
#include "lib/util/System.h"
class KeyboardDemo : public Kernel::Thread {
private:
Kernel::KeyEventListener listener;
public:
KeyboardDemo(const KeyboardDemo &copy) = delete;
KeyboardDemo() : listener(tid) {
Kernel::kevman.subscribe(listener);
}
// Base class destructor will be called automatically
~KeyboardDemo() override {
if (running) {
// NOTE: If the thread was exited nicely it can unlock before destructor,
// but on forced kill Util::System::out has to be unlocked in the destructor.
// This is bad since it could release the lock although some other
// thread set it (so use nice_kill)
Util::System::out.unlock();
}
Kernel::kevman.unsubscribe(listener);
}
void run() override;
};
#endif