From: Eric Wong Date: 2012-02-03T07:39:47+09:00 Subject: [ruby-core:42330] Re: [RFC/PATCH] reinit signal_thread_list_lock atfork Eric Wong wrote: > also applies to trunk. I cannot reproduce the original issue since I > don't have access to a FreeBSD machine, so this patch is a > stab-in-the-dark for me. > > I've only ensured this patch doesn't break existing behavior under > Linux/NPTL, not that it fixes a real problem under FreeBSD. Of course, since I couldn't test/confirm, I just realized function/#ifdef ordering was wrong and the original patch was a no-op :x I've squashed the ordering change and replaced the "sig-th-list-atfork" branch on git://bogomips.org/ruby.git with commit e39ddff24902e8f605612445b93dd63ff6e9b855: diff --git a/thread_pthread.c b/thread_pthread.c index 52997ec..3cb4ca1 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -154,13 +154,6 @@ gvl_destroy(rb_vm_t *vm) native_mutex_destroy(&vm->gvl.lock); } -static void -gvl_atfork(rb_vm_t *vm) -{ - gvl_init(vm); - gvl_acquire(vm, GET_THREAD()); -} - #define NATIVE_MUTEX_LOCK_DEBUG 0 static void @@ -443,6 +436,16 @@ Init_native_thread(void) } static void +gvl_atfork(rb_vm_t *vm) +{ +#ifdef USE_SIGNAL_THREAD_LIST + native_mutex_initialize(&signal_thread_list_lock); +#endif + gvl_init(vm); + gvl_acquire(vm, GET_THREAD()); +} + +static void native_thread_init(rb_thread_t *th) { native_cond_initialize(&th->native_thread_data.sleep_cond, RB_CONDATTR_CLOCK_MONOTONIC); -- Eric Wong