Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need some clarification about singleton pattern

Does singleton design pattern make sure one single object reference or there is any chance/possibility of more then one ref of an object while implementing singleton pattern, I think in the case of multi threading there is a some chance of more then one object even we have implemented singleton pattern.

Please help.

like image 688
NoNaMe Avatar asked Sep 16 '26 02:09

NoNaMe


1 Answers

It is possible for threading to cause problems with a singleton. You can find a comprehensive set of solutions for making singletons thread safe here:

http://csharpindepth.com/Articles/General/Singleton.aspx

like image 167
technophebe Avatar answered Sep 19 '26 17:09

technophebe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!