KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What is the way to obtain a thread safe counter in C# with best possible performance? This is as simple as it gets: public static long GetNextValue() { long result; lock (LOCK) { result = COUNTER++; } return result; } But are there faster alternatives?
Tags (comma-separated)
Save Edits
Cancel