summaryrefslogtreecommitdiff
path: root/lib/singleton.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/singleton.rb')
-rw-r--r--lib/singleton.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/singleton.rb b/lib/singleton.rb
index 4aea574e7a1..2785c77134b 100644
--- a/lib/singleton.rb
+++ b/lib/singleton.rb
@@ -17,7 +17,12 @@ module Singleton
@__instance__ = nil
def instance
unless @__instance__
- @__instance__ = new
+ Thread.critical = true
+ begin
+ @__instance__ = new
+ ensure
+ Thread.critical = false
+ end
end
return @__instance__
end