On 06/03/12 01:54, Jeff Higgins wrote:
<http://docs.oracle.com/javase/7/docs/api/java/awt/SecondaryLoop.html>
<http://sellmic.com/blog/2012/02/29/hidden-java-7-features-secondaryloop/>
How will that work? I suppose that the enter() call sets off a new EDT,
and then blocks until exit() is called. Then it tries to claim back
responsibility for event dispatch as soon as the current EDT completes
an event. Each time the current EDT completes an event, it checks for
completed SecondaryLoops, i.e. one which has been exit()ed. At that
point, it wakes the thread blocked on that SL, and terminates, allowing
the other thread to take over as EDT.
Hmm, no it doesn't work like that. Try the progam below. It creates two
buttons; we'll call them A and B. When you click A, it greys out for 5
seconds; B for 10 seconds. If you click A then B before A is restored, A
has to wait for B to complete. It seems that A's SL simply re-enters the
event loop, so the second click is handled by that invocation, and must
re-enter the loop again. They can only unwind in reverse order.
Am I doing it wrong?
I haven't determined for sure that this is apropos.