diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-05-07 08:48:30 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-05-07 08:48:30 +0000 |
commit | a2018b004b7d5b764a13018337cf599559f4b1b9 (patch) | |
tree | 1c5e740fcd47bdb4adeefd007c7e393054eff8f2 /lib/singleton.rb | |
parent | 48b51f706aec7bbf467d6c9d97f97ac722f533ce (diff) | |
download | ruby-a2018b004b7d5b764a13018337cf599559f4b1b9.tar.gz ruby-a2018b004b7d5b764a13018337cf599559f4b1b9.tar.xz ruby-a2018b004b7d5b764a13018337cf599559f4b1b9.zip |
* eval.c (rb_eval): too many line trace call. (ruby-bugs PR#1320)
* numeric.c (flo_to_s): tweak output string based to preserve
decimal point and to remove trailing zeros. [ruby-talk:97891]
* string.c (rb_str_index_m): use unsigned comparison for T_FIXNUM
search. [ruby-talk:97342]
* hash.c (rb_hash_equal): returns true if two hashes have same set
of key-value set. [ruby-talk:97559]
* hash.c (rb_hash_eql): returns true if two hashes are equal and
have same default values.
* string.c (rb_str_equal): always returns true or false, never
returns nil. [ruby-dev:23404]
* io.c (rb_io_reopen): should use rb_io_check_io().
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@6263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/singleton.rb')
-rw-r--r-- | lib/singleton.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/singleton.rb b/lib/singleton.rb index 2954bfa15..18fda0bc5 100644 --- a/lib/singleton.rb +++ b/lib/singleton.rb @@ -13,7 +13,7 @@ # a == b # => true # a.new # NoMethodError - new is private ... # -# * ``The instance'' is created at instanciation time, in other +# * ``The instance'' is created at instantiation time, in other # words the first call of Klass.instance(), thus # # class OtherKlass @@ -44,11 +44,11 @@ # # * Klass._load(str) - calling Klass.instance() # -# * Klass._instanciate?() - returning ``the instance'' or +# * Klass._instantiate?() - returning ``the instance'' or # nil. This hook method puts a second (or nth) thread calling # Klass.instance() on a waiting loop. The return value # signifies the successful completion or premature termination -# of the first, or more generally, current "instanciation thread". +# of the first, or more generally, current "instantiation thread". # # # The instance method of Singleton are @@ -103,7 +103,7 @@ class << Singleton @__instance__ = nil # failed instance creation end end - elsif _instanciate?() + elsif _instantiate?() Thread.critical = false else @__instance__ = false @@ -144,7 +144,7 @@ class << Singleton end # waiting-loop hook - def _instanciate?() + def _instantiate?() while false.equal?(@__instance__) Thread.critical = false sleep(0.08) # timeout @@ -209,7 +209,7 @@ end -puts "\nThreaded example with exception and customized #_instanciate?() hook"; p +puts "\nThreaded example with exception and customized #_instantiate?() hook"; p Thread.abort_on_exception = false class Ups < SomeSingletonClass @@ -220,7 +220,7 @@ class Ups < SomeSingletonClass end class << Ups - def _instanciate? + def _instantiate? @enter.push Thread.current[:i] while false.equal?(@__instance__) Thread.critical = false @@ -247,7 +247,7 @@ class << Ups end end - def instanciate_all + def instantiate_all @enter = [] @leave = [] 1.upto(9) {|i| @@ -270,7 +270,7 @@ class << Ups end -Ups.instanciate_all +Ups.instantiate_all # results in message like # Before there were 0 Ups instance(s) # boom - thread #6 failed to create instance @@ -293,7 +293,7 @@ def Yup.new end end end -Yup.instanciate_all +Yup.instantiate_all puts "\n\n","Customized marshalling" |