diff options
Diffstat (limited to 'lib/singleton.rb')
-rw-r--r-- | lib/singleton.rb | 7 |
1 files changed, 6 insertions, 1 deletions
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 |