summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rts/win32/OSThreads.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/rts/win32/OSThreads.c b/rts/win32/OSThreads.c
index b738c80f58..17fa95d8a2 100644
--- a/rts/win32/OSThreads.c
+++ b/rts/win32/OSThreads.c
@@ -447,7 +447,12 @@ interruptOSThread (OSThreadId id)
void
joinOSThread (OSThreadId id)
{
- int ret = WaitForSingleObject(id, INFINITE);
+ HANDLE hdl;
+ if (!(hdl = OpenThread(SYNCHRONIZE,FALSE,id))) {
+ sysErrorBelch("interruptOSThread: OpenThread");
+ stg_exit(EXIT_FAILURE);
+ }
+ int ret = WaitForSingleObject(hdl, INFINITE);
if (ret != WAIT_OBJECT_0) {
sysErrorBelch("joinOSThread: error %d", ret);
}