Vladimir <xo***@tut.by> wrote:
Is synchronization for bool shared fields required in multithreaded
application?
Yes. It should either be volatile, or you should lock access.
Is there a cases when for example changing value from true to false in one
thread, when another thread is reading this field, will lead to true value
in this field?
It won't stop the first thread from actually writing the change out,
but you may not see the change when reading in the second thread unless
you have a lock or make the flag volatile.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too