ruby-changes:51499
From: normal <ko1@a...>
Date: Thu, 21 Jun 2018 08:38:25 +0900 (JST)
Subject: [ruby-changes:51499] normal:r63709 (trunk): thread_pthread.c: fix non-sleepy timer-thread with fork
normal 2018-06-21 08:38:21 +0900 (Thu, 21 Jun 2018) New Revision: 63709 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63709 Log: thread_pthread.c: fix non-sleepy timer-thread with fork This fixes bootstraptest/test_fork.rb for systems with sleepy timer thread disabled. Modified files: trunk/thread_pthread.c Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 63708) +++ thread_pthread.c (revision 63709) @@ -975,7 +975,6 @@ native_thread_create(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L975 return err; } -#if USE_SLEEPY_TIMER_THREAD static void native_thread_join(pthread_t th) { @@ -984,8 +983,6 @@ native_thread_join(pthread_t th) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L983 rb_raise(rb_eThreadError, "native_thread_join() failed (%d)", err); } } -#endif - #if USE_NATIVE_THREAD_PRIORITY @@ -1622,8 +1619,8 @@ native_stop_timer_thread(void) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1619 stopped = --system_working <= 0; if (TT_DEBUG) fprintf(stderr, "stop timer thread\n"); -#if USE_SLEEPY_TIMER_THREAD if (stopped) { +#if USE_SLEEPY_TIMER_THREAD /* prevent wakeups from signal handler ASAP */ timer_thread_pipe.owner_process = 0; @@ -1639,18 +1636,20 @@ native_stop_timer_thread(void) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1636 /* stop writing ends of pipes so timer thread notices EOF */ CLOSE_INVALIDATE(normal[1]); CLOSE_INVALIDATE(low[1]); +#endif /* timer thread will stop looping when system_working <= 0: */ native_thread_join(timer_thread.id); +#if USE_SLEEPY_TIMER_THREAD /* timer thread will close the read end on exit: */ VM_ASSERT(timer_thread_pipe.normal[0] == -1); VM_ASSERT(timer_thread_pipe.low[0] == -1); +#endif if (TT_DEBUG) fprintf(stderr, "joined timer thread\n"); timer_thread.created = 0; } -#endif return stopped; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/