From: John Carter Date: 2009-05-18T14:40:58+09:00 Subject: [ruby-core:23490] [Backport #1471] "Mutual join" deadlock detection faulty in 1.8.6 and 1.8.7 Issue #1471 has been updated by John Carter. Here is an alternate patch for ext/thread.c relative to ruby-1.8.7-p160... --- ext/thread/thread.c.orig 2009-05-18 17:31:50.225602484 +1200 +++ ext/thread/thread.c 2009-05-18 17:32:38.689286319 +1200 @@ -205,6 +205,16 @@ return ary; } +static void +adjust_join(const List *list, VALUE new) +{ + extern void rb_thread_set_join _((VALUE, VALUE)); + Entry *entry; + for (entry = list->entries; entry; entry = entry->next) { + rb_thread_set_join(entry->value, new); + } +} + static VALUE wake_thread(VALUE thread) { @@ -471,6 +481,11 @@ } waking = wake_one(&mutex->waiting); + + if (!NIL_P(waking)) { + adjust_join(&mutex->waiting, waking); + } + mutex->owner = waking; return waking; Even with the fix I'm still getting a deadlock. I will have to look at it somemore tomorrow. ---------------------------------------- http://redmine.ruby-lang.org/issues/show/1471 ---------------------------------------- http://redmine.ruby-lang.org