1

unsubscribe listeners in demo threads

This commit is contained in:
2022-07-16 20:14:31 +02:00
parent 1fd5717209
commit cd83f85680
2 changed files with 12 additions and 1 deletions

View File

@ -14,7 +14,12 @@ private:
public:
MainMenu() : listener(*this) {
log << INFO << "MainMenu initialized with ID: " << dec << this->tid << endl;
// kevman.subscribe(this->listener);
kevman.subscribe(this->listener);
}
~MainMenu() override {
log << INFO << "Unitialized MainMenu" << endl;
kevman.unsubscribe(this->listener);
}
void run() override;

View File

@ -27,6 +27,12 @@ public:
kevman.subscribe(this->listener);
}
// Base class destructor will be called automatically
~KeyboardDemo() override {
log << INFO << "Uninitialized KeyboardDemo" << endl;
kevman.unsubscribe(this->listener);
}
void run() override;
};