summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-22 04:02:03 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-22 04:02:03 +0000
commit215994ddcbd6e0354cbed1aaa940170c161f9b49 (patch)
treef35c395872bf773eb37c0075f7f40c75f2b3b8b7
parentdac4cd841af72c142342a39a34cfff371e93347e (diff)
(merged partially from r42927)
* lib/rubygems/core_ext/kernel_require.rb: Backport a fix for concurrent requires. [ruby-core:58918] [Backport #9224] see also https://github.com/rubygems/rubygems/pull/833 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@45100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rwxr-xr-xlib/rubygems/core_ext/kernel_require.rb28
2 files changed, 31 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 2db56e5c18..ce4fa34e0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sat Feb 22 12:55:24 2014 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ (merged partially from r42927)
+ * lib/rubygems/core_ext/kernel_require.rb: Backport a fix for concurrent
+ requires. [ruby-core:58918] [Backport #9224]
+ see also https://github.com/rubygems/rubygems/pull/833
+
Sat Feb 22 11:50:52 2014 Eric Wong <e@80x24.org>
* ext/socket/ancdata.c (bsock_sendmsg_internal): only retry on error
diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb
index 4cd120b120..a591d386a9 100755
--- a/lib/rubygems/core_ext/kernel_require.rb
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -50,7 +50,12 @@ module Kernel
# normal require handle loading a gem from the rescue below.
if Gem::Specification.unresolved_deps.empty? then
- return gem_original_require(path)
+ begin
+ RUBYGEMS_ACTIVATION_MONITOR.exit
+ return gem_original_require(path)
+ ensure
+ RUBYGEMS_ACTIVATION_MONITOR.enter
+ end
end
# If +path+ is for a gem that has already been loaded, don't
@@ -63,7 +68,12 @@ module Kernel
s.activated? and s.contains_requirable_file? path
}
- return gem_original_require(path) if spec
+ begin
+ RUBYGEMS_ACTIVATION_MONITOR.exit
+ return gem_original_require(path)
+ ensure
+ RUBYGEMS_ACTIVATION_MONITOR.enter
+ end if spec
# Attempt to find +path+ in any unresolved gems...
@@ -111,11 +121,21 @@ module Kernel
valid.activate
end
- gem_original_require path
+ begin
+ RUBYGEMS_ACTIVATION_MONITOR.exit
+ return gem_original_require(path)
+ ensure
+ RUBYGEMS_ACTIVATION_MONITOR.enter
+ end
rescue LoadError => load_error
if load_error.message.start_with?("Could not find") or
(load_error.message.end_with?(path) and Gem.try_activate(path)) then
- return gem_original_require(path)
+ begin
+ RUBYGEMS_ACTIVATION_MONITOR.exit
+ return gem_original_require(path)
+ ensure
+ RUBYGEMS_ACTIVATION_MONITOR.enter
+ end
end
raise load_error