views:

70

answers:

3

Is there any potential for issues when having multiple threads read static values or can they be read by any number of threads concurrently without issues? (C#)

+3  A: 

concurrent reads are perfectly fine, provided that there is not a write operation at the same time.

STW
+2  A: 

Yes, static members can be read concurrently without any issue. What you need to be worried about is write operations. In most cases it is best to block all threads while you write to guarantee that no concurrency issues are introduced by the write operation.

But concurrent reads without any writes will work perfectly without the need for blocking or any concurrecy-related corruption.

Andrew Hare
A: 

They will be fine until we reach the era of quantum computing, at which point the Heisenberg uncertainty principle indicates that reads will start behaving suspiciously like writes.

At least, that'd be pretty funny. In reality I know essentially nothing about quantum computing.

I think you're fine.

Dan Tao