TimedLock icon indicating copy to clipboard operation
TimedLock copied to clipboard

Lock(seconds

Open AnthonyVO opened this issue 4 years ago • 0 comments

Looking at the reference source for Monitor.Try() you can see that internally it uses milliseconds and that it converts a TimeSpan to Milliseconds.

Therefore the Lock() overload that creates a TimeSpan from the seconds parameter causes a bunch of wasted cycles as it creates a timespan that is immediately converted to milliseconds.

https://referencesource.microsoft.com/#mscorlib/system/threading/monitor.cs

AnthonyVO avatar Dec 24 '20 00:12 AnthonyVO