summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/thread/thread.c2
-rw-r--r--test/thread/test_cv.rb8
-rw-r--r--test/thread/test_queue.rb8
4 files changed, 23 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 3cfe9918c1..d1818fac8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Jan 22 15:59:39 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/thread/thread.c (Init_thread): ConditionVariable and Queue
+ are not able to copy. [ruby-core:59961] [Bug #9440]
+
Tue Jan 21 20:14:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* thread_pthread.c (rb_thread_create_timer_thread): fix for platforms
diff --git a/ext/thread/thread.c b/ext/thread/thread.c
index 5fb51fe756..befea9ae30 100644
--- a/ext/thread/thread.c
+++ b/ext/thread/thread.c
@@ -572,11 +572,13 @@ Init_thread(void)
id_sleep = rb_intern("sleep");
rb_define_method(rb_cConditionVariable, "initialize", rb_condvar_initialize, 0);
+ rb_undef_method(rb_cConditionVariable, "initialize_copy");
rb_define_method(rb_cConditionVariable, "wait", rb_condvar_wait, -1);
rb_define_method(rb_cConditionVariable, "signal", rb_condvar_signal, 0);
rb_define_method(rb_cConditionVariable, "broadcast", rb_condvar_broadcast, 0);
rb_define_method(rb_cQueue, "initialize", rb_queue_initialize, 0);
+ rb_undef_method(rb_cQueue, "initialize_copy");
rb_define_method(rb_cQueue, "push", rb_queue_push, 1);
rb_define_method(rb_cQueue, "pop", rb_queue_pop, -1);
rb_define_method(rb_cQueue, "empty?", rb_queue_empty_p, 0);
diff --git a/test/thread/test_cv.rb b/test/thread/test_cv.rb
index 9a9b407a5b..92179e8e45 100644
--- a/test/thread/test_cv.rb
+++ b/test/thread/test_cv.rb
@@ -188,4 +188,12 @@ INPUT
assert_nothing_raised(Exception) { mutex.synchronize {condvar.broadcast} }
end
+
+ def test_dup
+ bug9440 = '[ruby-core:59961] [Bug #9440]'
+ condvar = ConditionVariable.new
+ assert_raise(NoMethodError, bug9440) do
+ condvar.dup
+ end
+ end
end
diff --git a/test/thread/test_queue.rb b/test/thread/test_queue.rb
index bf8344fade..07a611ddd2 100644
--- a/test/thread/test_queue.rb
+++ b/test/thread/test_queue.rb
@@ -200,4 +200,12 @@ class TestQueue < Test::Unit::TestCase
timeout(1) { th2.join }
end
end
+
+ def test_dup
+ bug9440 = '[ruby-core:59961] [Bug #9440]'
+ q = Queue.new
+ assert_raise(NoMethodError, bug9440) do
+ q.dup
+ end
+ end
end