From ebab487fcd7633038b9272ddbe31c268cda15723 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 25 Nov 1999 09:03:08 +0000 Subject: 19991125 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/singleton.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/singleton.rb') diff --git a/lib/singleton.rb b/lib/singleton.rb index 4aea574e7a..2785c77134 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 -- cgit v1.2.3