From 1b70b0afd33da36327640ee9307dae98a7bc73fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Fri, 7 Sep 2012 17:55:26 -0400 Subject: [PATCH] wfreerdp-server: fix tiny race condition --- server/Windows/wfreerdp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/Windows/wfreerdp.c b/server/Windows/wfreerdp.c index f2fb0e74f..637f73b61 100644 --- a/server/Windows/wfreerdp.c +++ b/server/Windows/wfreerdp.c @@ -58,9 +58,6 @@ static DWORD WINAPI wf_peer_socket_listener(LPVOID lpParam) memset(rfds, 0, sizeof(rfds)); context = (wfPeerContext*) client->context; - context->socketEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - context->socketSemaphore = CreateSemaphore(NULL, 0, 1, NULL); - while (1) { rcount = 0; @@ -199,6 +196,8 @@ static DWORD WINAPI wf_peer_main_loop(LPVOID lpParam) context = (wfPeerContext*) client->context; wfi = context->info; + context->socketEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + context->socketSemaphore = CreateSemaphore(NULL, 0, 1, NULL); context->socketThread = CreateThread(NULL, 0, wf_peer_socket_listener, client, 0, NULL); printf("We've got a client %s\n", client->local ? "(local)" : client->hostname);