From 16b283f679c50b0f77f4a5738326dae2371ee6d5 Mon Sep 17 00:00:00 2001 From: KOSAKI Motohiro Date: Mon, 20 Dec 2010 01:35:17 +0900 Subject: [PATCH] reset thread lock state at fork Signed-off-by: KOSAKI Motohiro --- thread.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/thread.c b/thread.c index ac032ef..eda70bb 100644 --- a/thread.c +++ b/thread.c @@ -2780,6 +2780,14 @@ terminate_atfork_i(st_data_t key, st_data_t val, st_data_t current_th) rb_mutex_abandon_all(th->keeping_mutexes); } th->keeping_mutexes = NULL; + + /* Perhaps native thread locking state in libc is unstable value. + * We need reset it before thread destroying. Otherwise we may see + * insane deadlock scenario. + */ + native_mutex_initialize(&th->interrupt_lock); + native_thread_init(th); + thread_cleanup_func(th); } return ST_CONTINUE; -- 1.7.0.1