From: Paul Brannan Date: 2004-01-16T00:25:03+09:00 Subject: Re: Nested scopes and the Singleton pattern On Thu, Jan 15, 2004 at 06:39:13PM +0900, nobu.nokada@softhome.net wrote: > At Thu, 15 Jan 2004 13:55:44 +0900, > Hal Fulton wrote: > > > Just using Thread.critical. And seems close to your idea > > > excepting for it uses "instance" method rather than "new". > > Not accurate, it uses 3-state; before, during and after > creation, but I feel it should use mutex or something. I think I agree. It took me an hour to understand the Singleton code last time I read it, and when I look at it again now, I seem to have forgotten how it works. It seems like using a Mutex plus Thread.exclusive around the code that redefines instance() should be sufficient, but perhaps I'm missing something. Paul