From 20eb6afd15e4aa9b436283edd7377daba6d17b15 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 25 Apr 2009 09:59:36 +0200 Subject: [PATCH] Fix misuse of CreateThread() in Windows client We use the C run-time, so we better use its _beginthread(), too. CreateThread() can lead to deadlocks, at least with some versions of the C run-time. Broken in commit f082ef9f, v4.3.11. --- src/client/play.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/client/play.c b/src/client/play.c index 4b9f3d7a6..9e1a3e8f0 100644 --- a/src/client/play.c +++ b/src/client/play.c @@ -43,6 +43,7 @@ #include #include #else +#include #include #endif #include "linebuf.h" @@ -132,8 +133,8 @@ sigaction(int signal, struct sigaction *action, struct sigaction *oaction) * WIN32 does not support select type function on console input * so the client uses a separate thread to read input */ -static DWORD WINAPI -stdin_read_thread(LPVOID lpParam) +static void +stdin_read_thread(void *dummy) { for (;;) { switch (WaitForSingleObject(bounce_empty, INFINITE)) { @@ -146,7 +147,7 @@ stdin_read_thread(LPVOID lpParam) bounce_error = errno; break; case WAIT_ABANDONED: - return 0; + return; default: assert(0); } @@ -163,7 +164,7 @@ sysdep_stdin_init(void) bounce_empty = CreateEvent(NULL, FALSE, TRUE, NULL); bounce_full = CreateEvent(NULL, TRUE, FALSE, NULL); ctrl_c_event = CreateEvent(NULL, FALSE, FALSE, NULL); - CreateThread(NULL, 0, stdin_read_thread, NULL, 0, NULL); + _beginthread(stdin_read_thread, 0, NULL); } /* -- 2.43.0