You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexey Petrenko (JIRA)" <ji...@apache.org> on 2007/05/08 12:35:15 UTC
[jira] Closed: (HARMONY-3654) [classlib][awt] Busy waiting in
headless event dispatching
[ https://issues.apache.org/jira/browse/HARMONY-3654?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alexey Petrenko closed HARMONY-3654.
------------------------------------
> [classlib][awt] Busy waiting in headless event dispatching
> ----------------------------------------------------------
>
> Key: HARMONY-3654
> URL: https://issues.apache.org/jira/browse/HARMONY-3654
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Sergey Dmitriev
> Assigned To: Alexey Petrenko
> Attachments: headlessFix.patch
>
>
> Recently I've found that we have a busy waiting in classlib:
> modules/awt/src/main/java/common/java/awt/HeadlessEventDispatchThread.java. Namely:
> void runModalLoop(ModalContext context) {
> long lastPaintTime = System.currentTimeMillis();
> while (!shutdownPending && (context == null || context.isModalLoopRunning())) {
> try {
> EventQueue eventQueue = toolkit.getSystemEventQueueImpl();
> toolkit.shutdownWatchdog.setNativeQueueEmpty(true);
> AWTEvent ae = eventQueue.getNextEventNoWait(); // NO WAIT
> if (ae != null) {
> eventQueue.dispatchEvent(ae);
> long curTime = System.currentTimeMillis();
> if (curTime - lastPaintTime > 10) {
> toolkit.onQueueEmpty();
> lastPaintTime = System.currentTimeMillis();
> }
> } else {
> toolkit.shutdownWatchdog.setAwtQueueEmpty(true);
> toolkit.onQueueEmpty(); // NO WAITING UNDERLIES
> lastPaintTime = System.currentTimeMillis();
> }
> } catch (Throwable t) {
> t.printStackTrace();
> }
> }
> }
> It would be cool to lighten the whole thread. Java.awt.EventDispatchThread implementation can be taken as a start point.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.