ruby-changes:45405
From: ko1 <ko1@a...>
Date: Tue, 31 Jan 2017 15:39:05 +0900 (JST)
Subject: [ruby-changes:45405] ko1:r57478 (trunk): define rb_thread_sleep_deadly_allow_spurious_wakeup().
ko1 2017-01-31 15:39:01 +0900 (Tue, 31 Jan 2017) New Revision: 57478 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57478 Log: define rb_thread_sleep_deadly_allow_spurious_wakeup(). * thread.c, thread_sync.c: define new function rb_thread_sleep_deadly_allow_spurious_wakeup() and use it instead of using sleep_forever() directly. Modified files: trunk/thread.c trunk/thread_sync.c Index: thread_sync.c =================================================================== --- thread_sync.c (revision 57477) +++ thread_sync.c (revision 57478) @@ -420,7 +420,7 @@ rb_mutex_abandon_all(rb_mutex_t *mutexes https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L420 static VALUE rb_mutex_sleep_forever(VALUE time) { - sleep_forever(GET_THREAD(), TRUE, FALSE); /* permit spurious check */ + rb_thread_sleep_deadly_allow_spurious_wakeup(); return Qnil; } Index: thread.c =================================================================== --- thread.c (revision 57477) +++ thread.c (revision 57478) @@ -85,6 +85,7 @@ static ID id_locals; https://github.com/ruby/ruby/blob/trunk/thread.c#L85 static void sleep_timeval(rb_thread_t *th, struct timeval time, int spurious_check); static void sleep_wait_for_interrupt(rb_thread_t *th, double sleepsec, int spurious_check); static void sleep_forever(rb_thread_t *th, int nodeadlock, int spurious_check); +static void rb_thread_sleep_deadly_allow_spurious_wakeup(void); static double timeofday(void); static int rb_threadptr_dead(rb_thread_t *th); static void rb_check_deadlock(rb_vm_t *vm); @@ -1146,6 +1147,13 @@ rb_thread_sleep_deadly(void) https://github.com/ruby/ruby/blob/trunk/thread.c#L1147 sleep_forever(GET_THREAD(), TRUE, TRUE); } +static void +rb_thread_sleep_deadly_allow_spurious_wakeup(void) +{ + thread_debug("rb_thread_sleep_deadly_allow_spurious_wakeup\n"); + sleep_forever(GET_THREAD(), TRUE, FALSE); +} + static double timeofday(void) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/