[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: syncExec happens only after a GUI event

Here's another interesting example. I also tried asyncExec and explicitly
waking up the display and yielding to it, but the asyncExec still does not
occur until a GUI event (like mouse movement) wakes it up.

        Display.getCurrent().asyncExec( new Runnable() { ... });
        Display.getCurrent().wake();
        Thread.yield();

Cheers,
Shaun


Shaun Jackman wrote:
> I have a GUI thread and a computational thread. Upon calculating its
> result, the computational thread calls syncExec(new Runnable { ... })
> which adds an item to a List. Upon calling syncExec, the computational
> thread blocks. However, the GUI thread never wakes up. The GUI thread
> remains blocked, the computational thread is blocked, and nothing happens
> until a GUI event (for example some mouse movement) causes the GUI thread
> to wake up. At that point, the syncExec occurs, and everything returns to
> normal. How do I force the syncExec to occur now?
> 
> This seems like a FAQ to me, but I couldn't find the answer in the
> documentation.
> 
> libswt-gtk-3007.so
> org.eclipse.swt.gtk_2.1.0
> 
> Thanks,
> Shaun