From e334bb2ce5d8876b020ab681f21595e2e1c9d601 Mon Sep 17 00:00:00 2001 From: glass Date: Fri, 6 Sep 2013 15:15:07 +0000 Subject: * common.mk: use RUNRUBY instead of MINIRUBY because MINIRUBY can't require extension libraries. The patch is from nobu (Nobuyoshi Nakada). * ext/thread/extconf.rb: for build ext/thread/thread.c. * include/ruby/intern.h: ditto. * thread.c: ditto. * lib/thread.rb: removed and replaced by ext/thread/thread.c. * ext/thread/thread.c: Queue, SizedQueue and ConditionVariable implementations in C. This patch is based on patches from panaggio (Ricardo Panaggio) and funny_falcon (Yura Sokolov) and ko1 (Koichi Sasada). [ruby-core:31513] [Feature #3620] * test/thread/test_queue.rb (test_queue_thread_raise): add a test for ensuring that killed thread should be removed from waiting threads. It is based on a code by ko1 (Koichi Sasada). [ruby-core:45950] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/thread/test_queue.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/thread/test_queue.rb') diff --git a/test/thread/test_queue.rb b/test/thread/test_queue.rb index 30ce665ba3..563b91e748 100644 --- a/test/thread/test_queue.rb +++ b/test/thread/test_queue.rb @@ -1,6 +1,7 @@ require 'test/unit' require 'thread' require 'tmpdir' +require 'timeout' require_relative '../ruby/envutil' class TestQueue < Test::Unit::TestCase @@ -133,4 +134,25 @@ class TestQueue < Test::Unit::TestCase assert_same q, retval end + def test_queue_thread_raise + q = Queue.new + th1 = Thread.new do + begin + q.pop + rescue RuntimeError + sleep + end + end + th2 = Thread.new do + sleep 0.1 + q.pop + end + sleep 0.1 + th1.raise + sleep 0.1 + q << :s + assert_nothing_raised(TimeoutError) do + timeout(1) { th2.join } + end + end end -- cgit v1.2.3