harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Petrenko (JIRA)" <j...@apache.org>
Subject [jira] Closed: (HARMONY-3654) [classlib][awt] Busy waiting in headless event dispatching
Date Tue, 08 May 2007 10:35:15 GMT

     [ 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.


Mime
View raw message