29.06.2011 15:28, Hans-Peter Diettrich:
But if so, which variables (class fields...) can ever be treated as
non-volatile, when they can be used from threads other than the main
thread?

Without explicit synchronisation? Actually, none.

Do you understand the implication of your answer?

When it's up to every coder, to insert explicit synchronization whenever
required, how to determine the places where explicit code is required?

All places where any non-readonly data could be accessed by 2 or more threads should be protected. Thats it.
Main thread is no special in this regard.

In order to reduce potential collisions, different critical section objects (mutexes) can be used to protect different (think unrelated) blocks of data in more fine-grained way.

Nikolai


Aren't we then in the unpleasant situation, that *every* expression can
be evaluated using unsynchronized values, unless the compiler uses
synchronized read instructions to obtain *every* value [except from stack]?

DoDi

_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel



_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to