Display.getDefault().syncExec(...) deadlock? [message #660330] |
Thu, 17 March 2011 18:33  |
Eclipse User |
|
|
|
I have some code that often hangs the application when calling Display.getDefault().syncExec(...). Changing this to Display.getDefault().asyncExec(...) fixes that.
I wanted to figure out what threads are deadlocking, so I asked the Threading MBean's findDeadlockedThreads and findMonitorDeadlockedThreads, but both return null. The thread dump shows all threads RUNNABLE or TIMED_WAITING (on object monitor). There is no CPU usage, no network utilization, and no IO while the application is hanging, and the application has to be killed.
Is it correct to conclude that the deadlock must therefore be happening in native (i.e. SWT) code?
|
|
|
|
|
|
Re: Display.getDefault().syncExec(...) deadlock? [message #660511 is a reply to message #660507] |
Fri, 18 March 2011 13:34  |
Eclipse User |
|
|
|
David Wegener wrote on Fri, 18 March 2011 13:12 | If the code that is calling syncExec is running on the display thread, then this will cause the deadlock [...]
|
Thanks for the explanation. However, I don't understand why calling syncExec from the display thread doesn't deadlock all the time? In fact, the following code never seems to deadlock:
Display.getCurrent().syncExec(new Runnable() {
@Override
public void run() {
log.debug("=== sync exec ===");
Display.getCurrent().syncExec(new Runnable() {
@Override
public void run() {
log.debug("=== sync exec ===");
}
});
}
});
log.debug("=== done ===");
[Updated on: Fri, 18 March 2011 13:35] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.25418 seconds