summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2005-01-23 14:15:42 +0000
committerdarkvater <darkvater@openttd.org>2005-01-23 14:15:42 +0000
commit9a96f5b64e08ec6c8043e4e389f172e8bf5c460d (patch)
tree188f51924e42ae46e143ec6e99f44d1199aa34da
parent52ec917125543b29714bb9f998109eb72cf45dc6 (diff)
downloadopenttd-9a96f5b64e08ec6c8043e4e389f172e8bf5c460d.tar.xz
(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)
-rw-r--r--dedicated.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/dedicated.c b/dedicated.c
index b05c3b542..48d330d43 100644
--- a/dedicated.c
+++ b/dedicated.c
@@ -89,6 +89,7 @@ static void DedicatedSignalHandler(int sig)
#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 WINAPI CheckForConsoleInput(void)
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 CreateWindowsConsoleThread(void)
void CloseWindowsConsoleThread(void)
{
CloseHandle(hThread);
+ CloseHandle(hEvent);
DEBUG(misc, 0) ("Windows console thread shut down...");
}