summaryrefslogtreecommitdiff
path: root/win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32.c')
-rw-r--r--win32.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/win32.c b/win32.c
index a2ef16322..3c02511f8 100644
--- a/win32.c
+++ b/win32.c
@@ -2242,3 +2242,26 @@ 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_BELOW_NORMAL);
+
+ return (hThread == NULL) ? false : true;
+}
+
+void CloseOTTDThread(void)
+{
+ if (!CloseHandle(hThread)) DEBUG(misc, 0) ("Failed to close thread?...");
+}
+
+void JoinOTTDThread(void)
+{
+ if (hThread == NULL) return;
+
+ WaitForSingleObject(hThread, INFINITE);
+} \ No newline at end of file