[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Re: Runnable in synchExec() never gets started

I'm not exactly sure but one thing is your mTread is useless. You are calling the shutdown hook from both the syncExec AND the Thread (because you passed the shutdown runnable into the Thread's constructor, so it becomes the runnable for the thread). And the thread will fail if it ever does run because it is trying to do things to the shell and it is not the UI thread (by definition the thread is not the UI thread since you created it yourself and didn't create the display on it).

Second question is the thread you are calling display.syncExec(shutdown) the UI thread? If it isn't then maybe the UI thread is blocked and not responding. In that case the syncExec which just wait until the UI thread is unblocked.


ShutdownHook shutdown = new ShutdownHook(); Thread mThread = new Thread(shutdown,"SHUTDOWNTHREAD");
myScanner.setStatusMessage("The end is near any moment now"); myScanner.unLoad(); //shell.dispose();
if (display != null && !display.isDisposed()) {
myScanner.setStatusMessage("I am about to dispose of this application");
display.syncExec(shutdown);
mThread.start();
} else {
myScanner.setStatusMessage("U have already disposed of the application here...go Home");
}
.....



-- Thanks, Rich Kulp