<AWT Dev> Endless loop in EventDispatchThread - proposed solution

Clemens Eisserer linuxhippy at gmail.com
Wed Aug 24 08:33:58 PDT 2011


Hi Artem,

Thanks for taking a look.


The full patch also looks OK. Yesterday I thought in exactly the same
> direction and here is my observation. EDT.pumpEventsForFilters(id) can
> return the "false" value only if the thread is interrupted or stopped
> (ThreadDeath is caught). Therefore when the pumpEvents() call in EDT.run()
> exits, "shutdown" is always true. That's why I wrote about detaching the
> event dispatch thread unconditionally in my previous email.
>

There is also the doDispatch variable set in stopDispatching(), in this case
the "old" code did dispatch the events left in the queue. Therefor the
additional "shutdown" variable.

Setting shutdown = true when catching an InterruptedException is probably a
bit redundant, because as far as I know for an InterruptedException to be
thrown, interrup() has to be called - which sets shutdown = true before
interrupting the thread anyway. I thought I better set it, as doesn't hurt
;)

Thanks, Clemens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20110824/31fc76d8/attachment.html 


More information about the awt-dev mailing list