From a3e1b1ce7ed7e7ffac23015fc2fde56511b30681 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 31 Dec 2006 15:02:22 +0000 Subject: * Merge YARV git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/singleton.rb | 125 ++++++++++++++++++------------------------------------- 1 file changed, 40 insertions(+), 85 deletions(-) (limited to 'lib/singleton.rb') diff --git a/lib/singleton.rb b/lib/singleton.rb index 0ab8517275..2c08f35e37 100644 --- a/lib/singleton.rb +++ b/lib/singleton.rb @@ -60,7 +60,7 @@ # and _dump(depth) hooks allows the (partially) resurrections of # a previous state of ``the instance''. - +require 'thread' module Singleton # disable build-in copying methods @@ -72,65 +72,19 @@ module Singleton end private + # default marshalling strategy - def _dump(depth=-1) + def _dump(depth = -1) '' end -end - -class << Singleton - # Method body of first instance call. - FirstInstanceCall = proc do - # @__instance__ takes on one of the following values - # * nil - before and after a failed creation - # * false - during creation - # * sub_class instance - after a successful creation - # the form makes up for the lack of returns in progs - Thread.critical = true - if @__instance__.nil? - @__instance__ = false - Thread.critical = false - begin - @__instance__ = new - ensure - if @__instance__ - class <