ruby-changes:42886
From: nobu <ko1@a...>
Date: Mon, 9 May 2016 09:50:03 +0900 (JST)
Subject: [ruby-changes:42886] nobu:r54960 (trunk): thread.c: clear atfork functions
nobu 2016-05-09 10:46:37 +0900 (Mon, 09 May 2016) New Revision: 54960 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54960 Log: thread.c: clear atfork functions * thread.c (rb_thread_atfork, rb_thread_atfork_before_exec): do nothing unless working fork is available. * thread_sync.c (rb_mutex_abandon_all): define only if working fork is available. * thread_sync.c (rb_mutex_abandon_keeping_mutexes): ditto. * thread_sync.c (rb_mutex_abandon_locking_mutex): ditto. * thread_win32.c (gvl_init): never used. Modified files: trunk/ChangeLog trunk/thread.c trunk/thread_sync.c trunk/thread_win32.c Index: ChangeLog =================================================================== --- ChangeLog (revision 54959) +++ ChangeLog (revision 54960) @@ -1,3 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon May 9 10:46:36 2016 Nobuyoshi Nakada <nobu@r...> + + * thread.c (rb_thread_atfork, rb_thread_atfork_before_exec): do + nothing unless working fork is available. + + * thread_sync.c (rb_mutex_abandon_all): define only if working + fork is available. + + * thread_sync.c (rb_mutex_abandon_keeping_mutexes): ditto. + + * thread_sync.c (rb_mutex_abandon_locking_mutex): ditto. + + * thread_win32.c (gvl_init): never used. + Mon May 9 07:18:06 2016 NAKAMURA Usaku <usa@r...> * include/ruby/{defines,ruby}.h: need to define function attributes Index: thread_win32.c =================================================================== --- thread_win32.c (revision 54959) +++ thread_win32.c (revision 54960) @@ -113,13 +113,6 @@ gvl_yield(rb_vm_t *vm, rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/thread_win32.c#L113 gvl_acquire(vm, th); } - -static void -gvl_atfork(rb_vm_t *vm) -{ - rb_bug("gvl_atfork() is called on win32"); -} - static void gvl_init(rb_vm_t *vm) { Index: thread_sync.c =================================================================== --- thread_sync.c (revision 54959) +++ thread_sync.c (revision 54960) @@ -14,9 +14,11 @@ typedef struct rb_mutex_struct { https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L14 int allow_trap; } rb_mutex_t; +#if defined(HAVE_WORKING_FORK) static void rb_mutex_abandon_all(rb_mutex_t *mutexes); static void rb_mutex_abandon_keeping_mutexes(rb_thread_t *th); static void rb_mutex_abandon_locking_mutex(rb_thread_t *th); +#endif static const char* rb_mutex_unlock_th(rb_mutex_t *mutex, rb_thread_t volatile *th); /* @@ -378,6 +380,7 @@ rb_mutex_unlock(VALUE self) https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L380 return self; } +#if defined(HAVE_WORKING_FORK) static void rb_mutex_abandon_keeping_mutexes(rb_thread_t *th) { @@ -412,6 +415,7 @@ rb_mutex_abandon_all(rb_mutex_t *mutexes https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L415 mutex->next_mutex = 0; } } +#endif static VALUE rb_mutex_sleep_forever(VALUE time) Index: thread.c =================================================================== --- thread.c (revision 54959) +++ thread.c (revision 54960) @@ -3917,6 +3917,7 @@ rb_thread_start_timer_thread(void) https://github.com/ruby/ruby/blob/trunk/thread.c#L3917 rb_thread_create_timer_thread(); } +#if defined(HAVE_WORKING_FORK) static int clear_coverage_i(st_data_t key, st_data_t val, st_data_t dummy) { @@ -3992,6 +3993,17 @@ rb_thread_atfork_before_exec(void) https://github.com/ruby/ruby/blob/trunk/thread.c#L3993 { rb_thread_atfork_internal(terminate_atfork_before_exec_i); } +#else +void +rb_thread_atfork(void) +{ +} + +void +rb_thread_atfork_before_exec(void) +{ +} +#endif struct thgroup { int enclosed; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/