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

ruby-changes:26693

From: glass <ko1@a...>
Date: Wed, 9 Jan 2013 10:00:50 +0900 (JST)
Subject: [ruby-changes:26693] glass:r38744 (trunk): * load.c (load_lock): fix not to delete thread shield twice.

glass	2013-01-09 09:59:30 +0900 (Wed, 09 Jan 2013)

  New Revision: 38744

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

  Log:
    * load.c (load_lock): fix not to delete thread shield twice.
      it may break the shield locked by another thread.
      [Bug #7530] [ruby-core:50645]
    
    * test/ruby/test_require.rb: a test for above.

  Modified files:
    trunk/ChangeLog
    trunk/load.c
    trunk/test/ruby/test_require.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38743)
+++ ChangeLog	(revision 38744)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jan  9 09:53:23 2013  Masaki Matsushita  <glass.saga@g...>
+
+	* load.c (load_lock): fix not to delete thread shield twice.
+	  it may break the shield locked by another thread.
+	  [Bug #7530] [ruby-core:50645]
+
+	* test/ruby/test_require.rb: a test for above.
+
 Wed Jan  9 02:13:22 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* include/ruby/ruby.h (RBasic): to be aligned on a VALUE size
Index: load.c
===================================================================
--- load.c	(revision 38743)
+++ load.c	(revision 38744)
@@ -668,9 +668,6 @@ load_lock(const char *ftptr) https://github.com/ruby/ruby/blob/trunk/load.c#L668
     }
     switch (rb_thread_shield_wait((VALUE)data)) {
       case Qfalse:
-	data = (st_data_t)ftptr;
-	st_delete(loading_tbl, &data, 0);
-	return 0;
       case Qnil:
 	return 0;
     }
Index: test/ruby/test_require.rb
===================================================================
--- test/ruby/test_require.rb	(revision 38743)
+++ test/ruby/test_require.rb	(revision 38744)
@@ -604,4 +604,25 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L604
       }
     }
   end
+
+  def test_require_with_loaded_features_pop
+    bug7530 = '[ruby-core:50645]'
+    assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7530)
+      THREADS = 2
+      ITERATIONS_PER_THREAD = 1000
+
+      $: << '.'
+      system 'touch __load_path_bench_script__.rb'
+      THREADS.times.map {
+        Thread.new do
+          ITERATIONS_PER_THREAD.times do
+            require '__load_path_bench_script__'
+            $".pop
+          end
+        end
+      }.each(&:join)
+      system 'rm __load_path_bench_script__.rb'
+      p :ok
+    INPUT
+  end
 end

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

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