summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-28 05:46:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-28 05:46:32 +0000
commit079545cd8c7a2c0da45977bec7d88aa3d1232820 (patch)
tree3cc31c2147c0213634c2846d5cced3aa6fa93b5b /thread_pthread.c
parent450463d5fbc7098666c1405b5ea1ece4c8dd04a5 (diff)
* thread_pthread.c (gvl_reinit): register atfork hander only in
the parent process, to get rid of dead lock. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c12
1 files changed, 8 insertions, 4 deletions
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;