multithreading - Event Dispatch Thread meets the Java Memory Model -
It was already I asked, where the answer was:
is related to many fields Accessed by thread, it should be unstable or final, or arrive with synchronized blocks only. Otherwise, the assigned values can not be visible to other threads.
Also, anything that manipulates pixels on the screen should be run from it, though it is handled transparently when using color / paint again.
Therefore, in my opinion, we need to worry about the memory model because the screen running on the phantom is somewhat simpler in the form of animation.
My question is, it is correct to understand, and for example the sun tutorial example. (Wrong)
You know, I think that you can be a point here. The TumbleItem code uses worker.isDone ()
to see if the work is completed or not. However, I do not think that it causes a complete "synchronize".
My reading of the JDK 1.6 code is that uses swingworker. ISDIN (
) FutureTask
which is a sync
Uses a vaporous state
with attribute for the object isDone ()
does not seem to include the execution path synchronize
method or block it happens.
I am not a real expert on newer concurrent classes, but I think that coolant should call worker.get ()
so that proper synchronization is guaranteed.
EDIT: I am talking about the use of EDT img
array which is populated by the worker, however, it also appears that the use of the initial parameter by the EDT Is an issue with, as noted by @The Fist.
Comments
Post a Comment