summaryrefslogtreecommitdiff
path: root/lib/rubygems/core_ext
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2019-11-12 09:35:26 +0900
committerKoichi Sasada <ko1@atdot.net>2019-11-12 09:37:34 +0900
commit4a30fabfcfd72bd61bf1dad61f168eaba6100f12 (patch)
tree8d0ea55f5ca7add28282c9bfc7e89e72210357c3 /lib/rubygems/core_ext
parent2407e8972561143b34970fb5d9095be32676c685 (diff)
Monitor owner state check correctly.
Monitor can be owned at the beginning of this method.
Diffstat (limited to 'lib/rubygems/core_ext')
-rw-r--r--lib/rubygems/core_ext/kernel_require.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb
index 944bb93..ccbb2c0 100644
--- a/lib/rubygems/core_ext/kernel_require.rb
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -32,6 +32,7 @@ module Kernel
# that file has already been loaded is preserved.
def require(path)
+ monitor_owned = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?
RUBYGEMS_ACTIVATION_MONITOR.enter
path = path.to_path if path.respond_to? :to_path
@@ -166,7 +167,7 @@ module Kernel
raise load_error
ensure
- if RUBYGEMS_ACTIVATION_MONITOR.mon_owned?
+ if !monitor_owned && RUBYGEMS_ACTIVATION_MONITOR.mon_owned?
STDERR.puts [$$, Thread.current, $!, $!.backtrace].inspect if $!
raise "CRITICAL: RUBYGEMS_ACTIVATION_MONITOR is holding."
end