summaryrefslogtreecommitdiff
path: root/thread_win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'thread_win32.c')
-rw-r--r--thread_win32.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/thread_win32.c b/thread_win32.c
index feba5ecfcc..0befbff4ae 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -558,6 +558,15 @@ rb_thread_create_timer_thread(void)
}
}
-#define native_stop_timer_thread() (CloseHandle(timer_thread_lock), timer_thread_lock = 0)
+static int
+native_stop_timer_thread(void)
+{
+ int stopped = --system_working <= 0;
+ if (stopped) {
+ CloseHandle(timer_thread_lock);
+ timer_thread_lock = 0;
+ }
+ return stopped;
+}
#endif /* THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION */