From a026ad4958fde552474d5873cc146ff291ba3bcc 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 --- vm_core.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'vm_core.h') diff --git a/vm_core.h b/vm_core.h index 88b3ccbdcb..4fb6e07619 100644 --- a/vm_core.h +++ b/vm_core.h @@ -564,10 +564,12 @@ typedef struct rb_vm_struct { VALUE self; rb_global_vm_lock_t gvl; - rb_nativethread_lock_t thread_destruct_lock; struct rb_thread_struct *main_thread; - struct rb_thread_struct *running_thread; + + /* persists across uncontended GVL release/acquire for time slice */ + const struct rb_thread_struct *running_thread; + #ifdef USE_SIGALTSTACK void *main_altstack; #endif @@ -1583,7 +1585,7 @@ void rb_vm_pop_frame(rb_execution_context_t *ec); void rb_thread_start_timer_thread(void); void rb_thread_stop_timer_thread(void); void rb_thread_reset_timer_thread(void); -void rb_thread_wakeup_timer_thread(void); +void rb_thread_wakeup_timer_thread(int); static inline void rb_vm_living_threads_init(rb_vm_t *vm) -- cgit v1.2.3