Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Simple Display.asynchExec() problem
Simple Display.asynchExec() problem [message #454476] Thu, 21 April 2005 17:45 Go to next message
Eclipse UserFriend
I can't figure out what in the world I'm missing here. All I'm trying to
do is to run a simple thread using Display.asynchExec(). The problem is
that the GUI locks up until the seperate thread is finished executing (as
if it were executing using display.synchExec()).

For example the code below will lock up the GUI until its loop is
finished. I give up, does anyone see what is wrong?
Display.getCurrent().asyncExec (new Runnable () {
public void run () {
for(int i = 0; i < 10000; i++)
System.out.println("hello from asynchExec thread");

}
});
Re: Simple Display.asynchExec() problem [message #454479 is a reply to message #454476] Thu, 21 April 2005 19:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

asyncexec does not start a new thread. What it does is run the runnable
in the UI thread. So if your runnable does alot of things, it will lock
up the ui thread.

asyncexec means queue it off and the UI thread will run it when it gets
a chance. syncexec means run this runnable in the ui thread now, and
don't return until it has completed.


--
Thanks,
Rich Kulp
Re: Simple Display.asynchExec() problem [message #454552 is a reply to message #454479] Sat, 23 April 2005 23:52 Go to previous message
Eclipse UserFriend
Rich,
Thanks for the pointers, it helped me figure out the concept, SWT is
forcing me to learn more about threads. With that I completed the task of
redirecting the system.out to a text widget in my SWT app. Yahoo!

> asyncexec does not start a new thread. What it does is run the runnable
> in the UI thread. So if your runnable does alot of things, it will lock
> up the ui thread.

> asyncexec means queue it off and the UI thread will run it when it gets
> a chance. syncexec means run this runnable in the ui thread now, and
> don't return until it has completed.
Previous Topic:eclipse doesn't load button images
Next Topic:PNG support in SWT Toolbar
Goto Forum:
  


Current Time: Sat Jul 12 20:18:27 EDT 2025

Powered by FUDForum. Page generated in 0.03860 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top