diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | thread_pthread.c | 12 |
2 files changed, 13 insertions, 4 deletions
@@ -1,3 +1,8 @@ +Sun Nov 28 14:46:24 2010 Nobuyoshi Nakada <[email protected]> + + * thread_pthread.c (gvl_reinit): register atfork hander only in + the parent process, to get rid of dead lock. + Sun Nov 28 12:23:57 2010 Koichi Sasada <[email protected]> * thread.c, vm_core.h: make gvl_acquire/release/init/destruct diff --git a/thread_pthread.c b/thread_pthread.c index 2207fde0e3..9966943f8e 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -132,22 +132,26 @@ gvl_atfork(rb_vm_t *vm) #endif } -static void gvl_init(rb_vm_t *vm); +static void gvl_reinit(rb_vm_t *vm); static void gvl_atfork_child(void) { - gvl_init(GET_VM()); + gvl_reinit(GET_VM()); } static void gvl_init(rb_vm_t *vm) { - int r; if (GVL_DEBUG) fprintf(stderr, "gvl init\n"); - native_mutex_initialize(&vm->gvl.lock); native_atfork(0, 0, gvl_atfork_child); + gvl_reinit(vm); +} +static void +gvl_reinit(rb_vm_t *vm) +{ + native_mutex_initialize(&vm->gvl.lock); vm->gvl.waiting_threads = 0; vm->gvl.waiting_last_thread = 0; vm->gvl.waiting = 0; |