Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-ui-dev] Issues with calling Display.syncExec() in plugin's shutdown() method

Hi all,

Well, soon after I sent this e-mail, I was examining the Display class,
and I came across the disposeExec() method.  This Display 'Exec' method
is barely mentioned in the documentation, unlike syncExec() and
asyncExec(), and it seems to do the job.  By passing the Runnable to
Display.getDefault().disposeExec(), the run() method of the Runnable is
now getting called while Eclipse is exiting, and Eclipse terminates
properly now.  I think that this is a proper use of disposeExec(), but
I'm not entirely certain of this from the sparse documentation.  Can
someone confirm/deny?

Thanks,
Aaron Levinson

-----Original Message-----
From: Levinson, Aaron N 
Sent: Wednesday, June 11, 2003 10:55 AM
To: platform-ui-dev@xxxxxxxxxxx
Subject: [platform-ui-dev] Issues with calling Display.syncExec() in
plugin's shutdown() method


Hi all,

I have been encountering difficulties in calling Display.syncExec()
within my plugin's shutdown() method.  Sometimes it works and returns
from Display.syncExec(), but other times, it never returns.  When this
happens, the call stack for the main Java thread is as follows:

Thread [main] (Suspended)
	Object.wait(long) line: not available [native method]
	RunnableLock(Object).wait() line: 426
	Synchronizer.syncExec(Runnable) line: 145
	Display.syncExec(Runnable) line: 2153
	MyPlugin.shutdown() line: 243
	PluginRegistry$2.run() line: 283
	InternalPlatform.run(ISafeRunnable) line: 889
	PluginRegistry$1.visit(IPluginDescriptor) line: 296
	PluginRegistry.accept(IPluginVisitor, boolean) line: 55
	PluginRegistry.shutdownPlugins() line: 299
	PluginRegistry.shutdown(IProgressMonitor) line: 265
	InternalPlatform.loaderShutdown() line: 520
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line:
not available [native method]
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
	Method.invoke(Object, Object[]) line: 324
	InternalBootLoader.shutdown() line: 979
	InternalBootLoader.run(String, URL, String, String[], Runnable)
line: 850
	BootLoader.run(String, URL, String, String[], Runnable) line:
461
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line:
not available [native method]
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
[local variables unavailable]
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
[local variables unavailable]
	Method.invoke(Object, Object[]) line: 324 [local variables
unavailable]
	Main.basicRun(String[]) line: 291
	Main.run(String[]) line: 747
	Main.main(String[]) line: 583

The only threads left running (at least on Windows) are three System
threads, in addition to the main application thread.

Is it okay to call Display.syncExec() from shutdown()?  If so, is there
any way to avoid the problems that I describe above?  Previously, I was
using Display.asyncExec(), but when doing this, sometimes the Runnable
was never run.  If it is not okay to use Display.syncExec(), what are my
alternatives?  What I would really like is some sort of preShutdown()
method in my plug-in, but shutdown() seems to be the only option.

Thanks for any help!

Aaron Levinson
_______________________________________________
platform-ui-dev mailing list
platform-ui-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-ui-dev


Back to the top