
6 May
2014
6 May
'14
8:50 p.m.
On 06/05/14 10:24, Gerd Petermann wrote:
@WanMil, Steve: Please review. In Main.java I use "synchronized" to make sure that concurrent updates are handled.
The synchronized is not required, since int accesses are atomic and it appears that all changes to it are made via the same thread anyway.
Mmmh, I have to do some nit picking: int variables need to be defined as volatile if they are accessed from multiple threads. Otherwise it is not ensured that they contain the latest change by another thread: http://www.javamex.com/tutorials/synchronization_volatile.shtml Anyhow if it is accessed and changed by one thread only it must not be declared as volatile :-) WanMil
..Steve