Codechange: Replace custom thread code with C++11 thread objects.

We assume a conforming C++11 compiler environment that has a valid <thread>-header.
Failure to run a real thread is handled gracefully.
This commit is contained in:
Michael Lutz
2019-03-17 01:59:46 +01:00
parent 05f4e73608
commit 05bc2ed7cb
35 changed files with 191 additions and 577 deletions

View File

@@ -73,6 +73,7 @@ static void DedicatedSignalHandler(int sig)
# include <time.h>
# include <tchar.h>
# include "../os/windows/win32.h"
# include "../thread.h"
static HANDLE _hInputReady, _hWaitForInputHandling;
static HANDLE _hThread; // Thread to close
static char _win_console_thread_buffer[200];
@@ -80,7 +81,7 @@ static char _win_console_thread_buffer[200];
/* Windows Console thread. Just loop and signal when input has been received */
static void WINAPI CheckForConsoleInput()
{
SetWin32ThreadName(-1, "ottd:win-console");
SetCurrentThreadName("ottd:win-console");
DWORD nb;
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);