Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT asyncExec() problem
SWT asyncExec() problem [message #436190] Wed, 12 May 2004 12:51
Eclipse UserFriend
Originally posted by: whoops.ukrtop.com

I have two-thread application. One thread receive network data, parse it
and call GUI to redraw canvas. GUI updates are called throw
Display.asyncExec() function on every package receive form network. The
problem is that asyncExec() is not executed on first package, when
multiple packages are received.
It works good with syncExec(), it works even when I run it in debug more
step-by-step, it works if put Thread.sleep(10) after first package is
received, but not work with asyncExec()..

Here is code:

//this run in separate thread and do receive network packages
NetworkListener.java:
public void run()
{
while (true) {
System.out.println ("receive iteration");
protocol.recvPackage();
}
}

//this receive/parse packages and do asyncExec for GUI updates
NetworkProtocol.java:
public void recvPackage()
{
...

System.out.println ("before parser start");
gameListener.getDisplay().asyncExec(new Runnable()
{
public void run()
{
System.out.println ("parse package");
parsePackage (package_type, package_bufs, package_len);
//parse package function do calls for GUI redraw
}
});
}

System.out.println ("after parser start");

The console output is:
receive iteration
before parser start
after parser start
receive iteration
before parser start
parse package
after parser start

As you see there is no 'parse package' message after first 'receive
iteration'. Any suggestions how to fix it?
Previous Topic:JFace and popup menus
Next Topic:border less button
Goto Forum:
  


Current Time: Fri Apr 26 08:19:26 GMT 2024

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

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

Back to the top