Object-InsideOut - Re: InsideOut Singleton?

Posted on Wed Jan 25 18:03:56 2006 by sbelton in response to 1703 (See the whole thread of 7)
Re: InsideOut Singleton?

What happens if the constructor takes a while to create the singleton (big database query for example), and a second process calls the new() method while the first one is still being run? Will I end up with 2 instances of my singleton?

I am using Class::Singleton together with Object::InsideOut at the moment:

package MyClass; { use strict; use Object::InsideOut; use base qw(Class::Singleton); sub _new_instance(){ my $class = shift @_; return $class->new(@_); } } ... # and then to get my singleton my $mc = MyClass->instance();
Direct Responses: 1706 | Write a response