(svn r2809) Implement more generic threading functions, which allow more than one thread

This commit is contained in:
tron
2005-08-05 09:15:41 +00:00
parent 4f9b0d5f29
commit 4696ef802a
11 changed files with 202 additions and 111 deletions

19
win32.c
View File

@@ -1193,25 +1193,6 @@ bool InsertTextBufferClipboard(Textbuf *tb)
return false;
}
static HANDLE hThread;
bool CreateOTTDThread(void *func, void *param)
{
DWORD dwThreadId;
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, param, 0, &dwThreadId);
SetThreadPriority(hThread, THREAD_PRIORITY_NORMAL);
return hThread != NULL;
}
void JoinOTTDThread(void)
{
if (hThread == NULL) return;
WaitForSingleObject(hThread, INFINITE);
if (!CloseHandle(hThread)) DEBUG(misc, 0) ("Failed to close thread handle!");
}
void CSleep(int milliseconds)
{