From 8724448ed5eacc86f903f85b6eb87895714b8569 Mon Sep 17 00:00:00 2001 From: usa Date: Sat, 21 Jun 2008 07:48:29 +0000 Subject: * thread_win32.c (native_sleep): must block reentrance when accessing th->unblock. fixed [ruby-core:17341], reported by Bill Kelly git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread_win32.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'thread_win32.c') 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; -- cgit v1.2.3