When is ReaderWriterLockSlim better than a simple lock?

后端 未结 10 1878
孤街浪徒
孤街浪徒 2020-11-29 16:16

I\'m doing a very silly benchmark on the ReaderWriterLock with this code, where reading happens 4x more often than writting:

class Program
{
    static void          


        
10条回答
  •  执念已碎
    2020-11-29 16:47

    When is ReaderWriterLockSlim better than a simple lock?

    When you have significantly more reads than writes.

提交回复
热议问题