From 3474be56d6143a499e7783efd8cc4c95d4764656 Mon Sep 17 00:00:00 2001 From: Aliaksey Kandratsenka Date: Wed, 6 Jan 2010 14:52:07 +0200 Subject: [PATCH] re-initialize timer_thread_{lock,cond} after fork --- thread_pthread.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/thread_pthread.c b/thread_pthread.c index e5ae3c1..7ba6336 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -789,6 +789,11 @@ rb_thread_create_timer_thread(void) pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN + (THREAD_DEBUG ? BUFSIZ : 0)); #endif + + /* we can be called after fork. And this variables need to be re-initialized */ + native_mutex_initialize(&timer_thread_lock); + native_cond_initialize(&timer_thread_cond); + native_mutex_lock(&timer_thread_lock); err = pthread_create(&timer_thread_id, &attr, thread_timer, 0); if (err != 0) { -- 1.6.5.7