Why is lock much slower than Monitor.TryEnter?

前端 未结 5 597
囚心锁ツ
囚心锁ツ 2021-02-07 03:06

Results

Lock: 85.3 microseconds

Monitor.TryEnter: 11.0 microseconds

Isn\'t the lock expanded into the same code?

Edit: Results with 1000 iteratio

5条回答
提交回复
热议问题