Project

General

Profile

Backport #1471 » ruby_1_8_7_reset_waitfor_on_dead_threads.patch

Reset wait_for when joining to a dead thread & check consistency on rb_thread_set_join - JohnCarter (John Carter), 05/19/2009 02:39 PM

View differences:

bld/i686-pc-linux-gnu/src/ruby-1.8.7-p160/ruby-1.8.7-p160/eval.c 2009-05-19 17:08:00.897101209 +1200
if (th->status != THREAD_STOPPED) continue;
if (th->wait_for & WAIT_JOIN) {
if (rb_thread_dead(th->join)) {
th->wait_for = 0;
th->status = THREAD_RUNNABLE;
found = 1;
}
......
return rb_thread_join0(rb_thread_check(thread), limit);
}
void
rb_thread_set_join(thread, join)
VALUE thread, join;
{
rb_thread_t th = rb_thread_check(thread);
rb_thread_t jth = rb_thread_check(join);
if ( (th->wait_for & WAIT_JOIN) == 0) {
rb_bug( "Internal consistency failure! Expected thread to already be in waiting to join state %0x, was in %0x", WAIT_JOIN, th->wait_for);
}
if (th->join != curr_thread) {
rb_bug( "Internal consistency failure! Should only invoke rb_thread_set_join from a mutex unlock. Thread join aiming at %0x which something other than current thread %0x", th->join, curr_thread);
}
th->join = jth;
}
/*
* call-seq:
(2-2/3)