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
11017 11017
	if (th->status != THREAD_STOPPED) continue;
11018 11018
	if (th->wait_for & WAIT_JOIN) {
11019 11019
	    if (rb_thread_dead(th->join)) {
11020
                th->wait_for = 0;
11020 11021
		th->status = THREAD_RUNNABLE;
11021 11022
		found = 1;
11022 11023
	    }
......
11466 11467
    return rb_thread_join0(rb_thread_check(thread), limit);
11467 11468
}
11468 11469

  
11470
void
11471
rb_thread_set_join(thread, join)
11472
    VALUE thread, join;
11473
{
11474
    rb_thread_t th = rb_thread_check(thread);
11475
    rb_thread_t jth = rb_thread_check(join);
11476
    if ( (th->wait_for & WAIT_JOIN) == 0) {
11477
       rb_bug( "Internal consistency failure! Expected thread to already be in waiting to join state %0x, was in %0x", WAIT_JOIN, th->wait_for);
11478
    }
11479

  
11480
    if (th->join != curr_thread) {
11481
       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);
11482
    }
11483

  
11484
    th->join = jth;
11485
}
11486

  
11469 11487

  
11470 11488
/*
11471 11489
 *  call-seq: