Dashboard > UDIG Developer Guide > Home > 5 FAQ > Eclipse RCP Questions > How to wait in the display thread
How to wait in the display thread Log In | Sign Up   View a printable version of the current page.

Added by Jesse Eichar , last edited by Administrator on Nov 16, 2007  (view change)
Labels: 
(None)

Q: How can I wait in the display thread? For example I want the display thread to join with another thread.

A: Use the display's read and dispatch method to run other jobs that are waiting for the display thread. Only when there are no more jobs waiting(readAndDispatch returns false when no more jobs are waiting) then let the thread sleep.

while( condition ) {
    //run a display event continue if there is more work todo.
    if ( display.readAndDispatch() ){
        continue;
    }
			
    //no more work to do in display thread, wait on request if request has not
    //finished
    if (condition)
        break ;

    Thread.sleep(300);
}
Powered by a free Atlassian Confluence Open Source Project License granted to uDig. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators
User-friendly Desktop Internet GIS