From 48b6bd74e2febde095ac85d818e94c0e58677647 Mon Sep 17 00:00:00 2001 From: normal Date: Mon, 13 Aug 2018 21:34:20 +0000 Subject: thread_pthread.c: eliminate timer thread by restructuring GVL This reverts commit 194a6a2c68e9c8a3536b24db18ceac87535a6051 (r64203). Race conditions which caused the original reversion will be fixed in the subsequent commit. [ruby-core:88360] [Misc #14937] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread_win32.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'thread_win32.c') diff --git a/thread_win32.c b/thread_win32.c index 2d5eac1ff4..6db1f25fa7 100644 --- a/thread_win32.c +++ b/thread_win32.c @@ -20,6 +20,8 @@ #define native_thread_yield() Sleep(0) #define unregister_ubf_list(th) +#define ubf_wakeup_all_threads() do {} while (0) +#define ubf_threads_empty() (1) static volatile DWORD ruby_native_thread_key = TLS_OUT_OF_INDEXES; @@ -680,18 +682,21 @@ static struct { static unsigned long __stdcall timer_thread_func(void *dummy) { + rb_vm_t *vm = GET_VM(); thread_debug("timer_thread\n"); rb_w32_set_thread_description(GetCurrentThread(), L"ruby-timer-thread"); while (WaitForSingleObject(timer_thread.lock, TIME_QUANTUM_USEC/1000) == WAIT_TIMEOUT) { - timer_thread_function(dummy); + timer_thread_function(); + ruby_sigchld_handler(vm); /* probably no-op */ + rb_threadptr_check_signal(vm->main_thread); } thread_debug("timer killed\n"); return 0; } void -rb_thread_wakeup_timer_thread(void) +rb_thread_wakeup_timer_thread(int sig) { /* do nothing */ } @@ -768,6 +773,26 @@ rb_reserved_fd_p(int fd) return 0; } +int +rb_sigwait_fd_get(rb_thread_t *th) +{ + return -1; /* TODO */ +} + +NORETURN(void rb_sigwait_fd_put(rb_thread_t *, int)); +void +rb_sigwait_fd_put(rb_thread_t *th, int fd) +{ + rb_bug("not implemented, should not be called"); +} + +NORETURN(void rb_sigwait_sleep(const rb_thread_t *, int, const struct timespec *)); +void +rb_sigwait_sleep(const rb_thread_t *th, int fd, const struct timespec *ts) +{ + rb_bug("not implemented, should not be called"); +} + rb_nativethread_id_t rb_nativethread_self(void) { -- cgit v1.2.1