diff options
author | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2016-11-20 17:18:29 +0100 |
---|---|---|
committer | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2016-11-20 17:18:29 +0100 |
commit | 3a15af29752cbb355f3a14a9c856bc2730264929 (patch) | |
tree | 3a15081a54c8e8fd0fce5cc98a8144b441cedfcd /modules/wincons | |
parent | 73659893b4a157aa027c4b037b1487428cd4ccc2 (diff) |
wincons: graceful closing of thread (fixes #151)
Diffstat (limited to 'modules/wincons')
-rw-r--r-- | modules/wincons/wincons.c | 5 |
1 files changed, 5 insertions, 0 deletions
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 |