-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: prasanth
Message 5 in Discussion

 Hi, I have taken a look at your code, and it depends on what IsAllowed *actually* 
does.  Two threads will certainly be able to call it at the same time, but for many 
things 
that's just fine. If, on the other hand, IsAllowed needs to read and write some 
variables from the singleton, it may *not* be threadsafe.

Put it this way: being part of a singleton isn't relevant here. If it would normally 
be okay for two threads to execute your method at a time, that's fine - otherwise 
you'll need locking just as you would elsewhere.   So as long as you don't use any 
instance variable you are fine, if you use an instance variable you should take care 
of synchronizating the access to it.

You should take a look at the attached document about singleton. It explain in details 
how to make it thread safe in the more efficient way.
 Thanks, Vishnu Prasath
View Attachment(s):
http://groups.msn.com/BDotNet/_notifications.msnw?type=msg&mview=1&parent=1&item=20126
-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to