diff options
author | Pawel Piech | 2010-05-10 17:18:49 +0000 |
---|---|---|
committer | Pawel Piech | 2010-05-10 17:18:49 +0000 |
commit | 0b0ecb059cd2cb0037468125fd5973f06a4a1e84 (patch) | |
tree | 2b2c63830f9828854b1becbff5d50dee8e90c758 | |
parent | 4c86aa38cee434c4b04693565ceebbe40b23f104 (diff) | |
download | eclipse.platform.debug-0b0ecb059cd2cb0037468125fd5973f06a4a1e84.tar.gz eclipse.platform.debug-0b0ecb059cd2cb0037468125fd5973f06a4a1e84.tar.xz eclipse.platform.debug-0b0ecb059cd2cb0037468125fd5973f06a4a1e84.zip |
Bug 311813 - Deadlock in RuntimeProcess.terminated()
-rw-r--r-- | org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java index 6df7e9c10..ad678ed3a 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java @@ -233,13 +233,23 @@ public class RuntimeProcess extends PlatformObject implements IProcess { if (fStreamsProxy instanceof StreamsProxy) { ((StreamsProxy)fStreamsProxy).close(); } + + + // Avoid calling IProcess.exitValue() inside a sync section (Bug 311813). + int exitValue = -1; + boolean running = false; + try { + exitValue = fProcess.exitValue(); + } catch (IllegalThreadStateException ie) { + running = true; + } + synchronized (this) { fTerminated= true; - try { - fExitValue = fProcess.exitValue(); - } catch (IllegalThreadStateException ie) { + if (!running) { + fExitValue = exitValue; } - fProcess= null; + fProcess= null; } fireTerminateEvent(); } |