TimedLock
TimedLock copied to clipboard
Lock(seconds) converts to a TimeSpan that is immediately converted to Milliseconds.
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