[前][次][番号順一覧][スレッド一覧]

ruby-changes:32602

From: nobu <ko1@a...>
Date: Wed, 22 Jan 2014 15:59:45 +0900 (JST)
Subject: [ruby-changes:32602] nobu:r44681 (trunk): thread/thread.c: no dup

nobu	2014-01-22 15:59:41 +0900 (Wed, 22 Jan 2014)

  New Revision: 44681

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44681

  Log:
    thread/thread.c: no dup
    
    * ext/thread/thread.c (Init_thread): ConditionVariable and Queue
      are not able to copy.  [ruby-core:59961] [Bug #9440]

  Modified files:
    trunk/ChangeLog
    trunk/ext/thread/thread.c
    trunk/test/thread/test_cv.rb
    trunk/test/thread/test_queue.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44680)
+++ ChangeLog	(revision 44681)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jan 22 15:59:39 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@r...>
 
 	* thread_pthread.c (rb_thread_create_timer_thread): fix for platforms
Index: ext/thread/thread.c
===================================================================
--- ext/thread/thread.c	(revision 44680)
+++ ext/thread/thread.c	(revision 44681)
@@ -572,11 +572,13 @@ Init_thread(void) https://github.com/ruby/ruby/blob/trunk/ext/thread/thread.c#L572
     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);
Index: test/thread/test_queue.rb
===================================================================
--- test/thread/test_queue.rb	(revision 44680)
+++ test/thread/test_queue.rb	(revision 44681)
@@ -200,4 +200,12 @@ class TestQueue < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/thread/test_queue.rb#L200
       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
Index: test/thread/test_cv.rb
===================================================================
--- test/thread/test_cv.rb	(revision 44680)
+++ test/thread/test_cv.rb	(revision 44681)
@@ -188,4 +188,12 @@ INPUT https://github.com/ruby/ruby/blob/trunk/test/thread/test_cv.rb#L188
 
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]