Bug #2240: returning from Monitor#synchronize causes 'ThreadError: killed thread' when no waiting thread is alive
http://redmine.ruby-lang.org/issues/show/2240

Author: Hiroshi NAKAMURA
Status: Open, Priority: Normal
Category: lib, Target version: Ruby 1.8.8
ruby -v: ruby 1.8.8dev (2009-03-30 revision 20884) [i686-linux]

def test_killed_thread_in_synchronize
    ary = []
    queue = Queue.new
    t1 = Thread.start {
      queue.pop
      @monitor.synchronize {
        ary << :t1
      }
    }
    t2 = Thread.start {
      queue.pop
      @monitor.synchronize {
        ary << :t2
      }
    }
    @monitor.synchronize do
      queue.enq(nil)
      queue.enq(nil)
      assert_equal([], ary)
      t1.kill
      t2.kill
      ary << :main
    end
    assert_equal([:main], ary)
  end


----------------------------------------
http://redmine.ruby-lang.org