Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Paralell getting information from array

$
0
0

Hello!

I have some shell of array and several write and read methods. I want to get it thread-safe and have opportunity to get data from different threads at the same time.

For example:

class MyClass
{
public void Write1() {...}
public void Write2() {...}
public void Read1() {...}
public void Read2() {...}
}

So we could read from different threads at the same time, but lock thread which want to write data.

And in this way we can't use lock() operation or Monitor, because in this way we can call only one method(read or write) at the same time. What is the best way to do it?



Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>