(svn r1615) -Fix: [1107350] console ignoring return character occasionally. For everyone that is running 2 dedicated servers on 1 windows machine, console input is now correct (event was the same so it was random which console received the input)
authordarkvater
Sun, 23 Jan 2005 14:15:42 +0000
changeset 1114 74e602e41692
parent 1113 da5c5c571541
child 1115 55b99683ce51
(svn r1615) -Fix: [1107350] console ignoring return character occasionally. For everyone that is running 2 dedicated servers on 1 windows machine, console input is now correct (event was the same so it was random which console received the input)
dedicated.c
--- a/dedicated.c	Sun Jan 23 13:45:20 2005 +0000
+++ b/dedicated.c	Sun Jan 23 14:15:42 2005 +0000
@@ -89,6 +89,7 @@
 #endif
 
 #ifdef WIN32
+#include <time.h>
 HANDLE hEvent;
 static HANDLE hThread; // Thread to close
 static char _win_console_thread_buffer[200];
@@ -104,8 +105,11 @@
 
 void CreateWindowsConsoleThread(void)
 {
+	static char tbuffer[9];
 	/* Create event to signal when console input is ready */
-	hEvent = CreateEvent(NULL, false, false, "keyboard input");
+	hEvent = CreateEvent(NULL, false, false, _strtime(tbuffer));
+	if (hEvent == NULL)
+		error("Cannot create console event!");
 
 	hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CheckForConsoleInput, 0, 0, NULL);
 	if (hThread == NULL)
@@ -117,6 +121,7 @@
 void CloseWindowsConsoleThread(void)
 {
 	CloseHandle(hThread);
+	CloseHandle(hEvent);
 	DEBUG(misc, 0) ("Windows console thread shut down...");
 }