try to fix hang on exit by keyboard

This commit is contained in:
2024-12-26 16:12:02 +03:00
parent 64025e0399
commit 855d1ca1b5
2 changed files with 11 additions and 4 deletions

View File

@@ -542,6 +542,10 @@ void PIKbdListener::readKeyboard() {
void PIKbdListener::stop() { void PIKbdListener::stop() {
PIThread::stop(); PIThread::stop();
#ifndef WINDOWS
char c = '\n';
write(0, &c, 1);
#endif
} }

View File

@@ -29,10 +29,13 @@
#include "pithread.h" #include "pithread.h"
#include "pitime.h" #include "pitime.h"
#define WAIT_FOR_EXIT \ #define WAIT_FOR_EXIT \
while (!PIKbdListener::exiting) \ while (!PIKbdListener::exiting) \
piMSleep(PIP_MIN_MSLEEP * 5); \ piMSleep(PIP_MIN_MSLEEP * 5); \
if (PIKbdListener::instance()) PIKbdListener::instance()->stopAndWait(); if (PIKbdListener::instance()) { \
PIKbdListener::instance()->stop(); \
PIKbdListener::instance()->waitForFinish(); \
}
class PIP_EXPORT PIKbdListener: public PIThread { class PIP_EXPORT PIKbdListener: public PIThread {