summaryrefslogtreecommitdiff
path: root/thread_win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'thread_win32.c')
-rw-r--r--thread_win32.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/thread_win32.c b/thread_win32.c
index 993f5f271d..8365ff2569 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -229,8 +229,10 @@ native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable)
{
DWORD ret;
+ native_mutex_lock(&th->interrupt_lock);
th->unblock.func = ubf_handle;
th->unblock.arg = th;
+ native_mutex_unlock(&th->interrupt_lock);
if (RUBY_VM_INTERRUPTED(th)) {
/* interrupted. return immediate */
@@ -241,8 +243,10 @@ native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable)
thread_debug("native_sleep done (%lu)\n", ret);
}
+ native_mutex_lock(&th->interrupt_lock);
th->unblock.func = 0;
th->unblock.arg = 0;
+ native_mutex_unlock(&th->interrupt_lock);
}
GVL_UNLOCK_END();
th->status = prev_status;