O'Reilly Forums: Multithreaded Singletion Pattern - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Multithreaded Singletion Pattern

#1 User is offline   techknackblogs 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 05-June 12

Posted 05 June 2012 - 10:07 PM

Any other approach for Multithreaded Singletion Patter other than provided in this link.
0

#2 User is offline   uriz 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 11-September 12

Posted 11 September 2012 - 11:47 AM

Hello

The link that you provided shows an implementation and mentions that the implementation is not thread safe but does not state why (I think there are some links missing there).

IMO, and as pointed out here, the basic implementation of Singleton should be thread safe, as long as you are using the static constructor for initializing the instance. The static constructor is thread safe so it's OK.

The access to the instansiation is not thread safe so the class that is inside the singleton should also be thread safe. If not, then you may need to limit the access to the actual instansiation (an example exists in the link I provided).

Thanks,
Uri
0

#3 User is offline   YAnuj 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 29-November 12

Posted 29 November 2012 - 05:39 AM

Hi,

Follow this link to understand singelton and multithreaded implementation.

Share and like if you think it is useful.

Thanks,
Anuj
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users