From 3a15af29752cbb355f3a14a9c856bc2730264929 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Sun, 20 Nov 2016 17:18:29 +0100 Subject: wincons: graceful closing of thread (fixes #151) --- modules/wincons/wincons.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules') diff --git a/modules/wincons/wincons.c b/modules/wincons/wincons.c index 7b7f275..769705a 100644 --- a/modules/wincons/wincons.c +++ b/modules/wincons/wincons.c @@ -43,6 +43,7 @@ static void destructor(void *arg) SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), st->mode); st->run = false; + WaitForSingleObject(st->hThread, 5000); CloseHandle(st->hThread); tmr_cancel(&st->tmr); @@ -102,6 +103,10 @@ static DWORD WINAPI input_thread(LPVOID arg) if (ch == '\r') ch = '\n'; + /* Special handling of 'q' (quit) */ + if (ch == 'q') + st->run = false; + /* * The keys are read from a thread so we have * to send them to the RE main event loop via -- cgit v1.2.3