Threads, lock, many readers, one exclusive writer

  • Thread starter Thread starter Tim Smith
  • Start date Start date
T

Tim Smith

Hi,

I am so far familiar with the C# lock keyword, which I understand
prevents any other thread from entering the portion of code which is
locked, assuming you are locking the same object instance.

I have a cache of data which initially I locked when I write to it,
and I locked the same object for any reading.

But this will soon become a performance issue, as many threads need to
read it concurrently.

What is the optimal approach?

thanks!

Tim
 
Back
Top