summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-09 00:59:30 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-09 00:59:30 +0000
commitbc0577c6c8607d57a13282a34c80f64fe9bf1eef (patch)
tree761a7885d5aafcd54a17a68e97b0567689bb2ba6
parent4ddf057b9aace467b707347209bb572ea2643c32 (diff)
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--load.c3
-rw-r--r--test/ruby/test_require.rb21
3 files changed, 29 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 15be43c..6ea54fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Wed Jan 9 09:53:23 2013 Masaki Matsushita <glass.saga@gmail.com>
+
+ * 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@ruby-lang.org>
* include/ruby/ruby.h (RBasic): to be aligned on a VALUE size
diff --git a/load.c b/load.c
index 70e3ee8..147307d 100644
--- a/load.c
+++ b/load.c
@@ -668,9 +668,6 @@ load_lock(const char *ftptr)
}
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;
}
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb
index 410edbb..1ff2d78 100644
--- a/test/ruby/test_require.rb
+++ b/test/ruby/test_require.rb
@@ -604,4 +604,25 @@ class TestRequire < Test::Unit::TestCase
}
}
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