[Mono-devel-list] Thread safety of readonly data members?

Michi Henning michi at zeroc.com
Wed Feb 18 14:28:54 EST 2004


gabor wrote:

> and btw.  is reading or writing a native/simple/non-object ( i don't
> know the exact term for this. i mean something like int, char and so on)
> an atomic operation?
> 
> for example if i have two threads, one writes to a variable randomly 1
> or 10. the other thread reads the variable in a loop and writes it to
> the screen. can i be sure that i will only see the numbers 1 and 10? 

Given the explanations in

http://research.microsoft.com/~birrell/papers/ThreadsCSharp.pdf

the other thread can actually read absolutely anything and may not
see either 1 or 10.

Cheers,

Michi.

--
Michi Henning              Ph: +61 4 1118-2700
ZeroC, Inc.                http://www.zeroc.com




More information about the Mono-devel-list mailing list