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

ruby-changes:33021

From: nagachika <ko1@a...>
Date: Sat, 22 Feb 2014 13:02:09 +0900 (JST)
Subject: [ruby-changes:33021] nagachika:r45100 (ruby_2_0_0): (merged partially from r42927)

nagachika	2014-02-22 13:02:03 +0900 (Sat, 22 Feb 2014)

  New Revision: 45100

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

  Log:
    (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

  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 45099)
+++ ruby_2_0_0/ChangeLog	(revision 45100)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Sat Feb 22 12:55:24 2014  CHIKANAGA Tomoyuki  <nagachika@r...>
+
+	(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@8...>
 
 	* ext/socket/ancdata.c (bsock_sendmsg_internal): only retry on error
Index: ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb
===================================================================
--- ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb	(revision 45099)
+++ ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb	(revision 45100)
@@ -50,7 +50,12 @@ module Kernel https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb#L50
     # 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 https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb#L68
       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 https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb#L121
       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

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

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