KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have the following Lock statement: private readonly object ownerLock_ = new object(); lock (ownerLock_) { } Should I use volatile keyword for my lock variable? private readonly volatile object ownerLock_ = new object(); On MSDN I saw that it usually used for a field that is accessed without locking, so if I use Lock I don't need to use volatile? From MSDN : The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock statement to serialize access.
Tags (comma-separated)
Save Edits
Cancel