1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

[291877] Potential deadlock because traces were using the executor.

This commit is contained in:
Marc Khouzam 2009-10-13 13:03:42 +00:00
parent 271832d5e4
commit 42ae2748df

View file

@ -79,7 +79,7 @@ public abstract class AbstractMIControl extends AbstractDsfService
// MI did not always support the --thread/--frame options // MI did not always support the --thread/--frame options
// This boolean is used to know if we should use -thread-select and -stack-select-frame instead // This boolean is used to know if we should use -thread-select and -stack-select-frame instead
private boolean fUseThreadAndFrameOptions; private final boolean fUseThreadAndFrameOptions;
// currentStackLevel and currentThreadId are only necessary when // currentStackLevel and currentThreadId are only necessary when
// we must use -thread-select and -stack-select-frame // we must use -thread-select and -stack-select-frame
private int fCurrentStackLevel = -1; private int fCurrentStackLevel = -1;
@ -142,14 +142,14 @@ public abstract class AbstractMIControl extends AbstractDsfService
* to disable tracing. * to disable tracing.
* @since 2.0 * @since 2.0
*/ */
protected void setMITracingStream(OutputStream tracingStream) { protected synchronized void setMITracingStream(OutputStream tracingStream) {
fTracingStream = tracingStream; fTracingStream = tracingStream;
} }
/** /**
* Returns the MI tracing stream. * Returns the MI tracing stream.
*/ */
private OutputStream getMITracingStream() { private synchronized OutputStream getMITracingStream() {
return fTracingStream; return fTracingStream;
} }
@ -564,8 +564,6 @@ public abstract class AbstractMIControl extends AbstractDsfService
fOutputStream.flush(); fOutputStream.flush();
GdbPlugin.debug(GdbPlugin.getDebugTime() + MI_TRACE_IDENTIFIER + str); GdbPlugin.debug(GdbPlugin.getDebugTime() + MI_TRACE_IDENTIFIER + str);
getExecutor().execute(new DsfRunnable() {
public void run() {
if (getMITracingStream() != null) { if (getMITracingStream() != null) {
try { try {
String message = GdbPlugin.getDebugTime() + " " + str; //$NON-NLS-1$ String message = GdbPlugin.getDebugTime() + " " + str; //$NON-NLS-1$
@ -583,8 +581,6 @@ public abstract class AbstractMIControl extends AbstractDsfService
} }
} }
} }
});
}
} catch (IOException e) { } catch (IOException e) {
// Shutdown thread in case of IO error. // Shutdown thread in case of IO error.
break; break;
@ -618,8 +614,6 @@ public abstract class AbstractMIControl extends AbstractDsfService
GdbPlugin.debug(GdbPlugin.getDebugTime() + MI_TRACE_IDENTIFIER + line + "\n"); //$NON-NLS-1$ GdbPlugin.debug(GdbPlugin.getDebugTime() + MI_TRACE_IDENTIFIER + line + "\n"); //$NON-NLS-1$
final String finalLine = line; final String finalLine = line;
getExecutor().execute(new DsfRunnable() {
public void run() {
if (getMITracingStream() != null) { if (getMITracingStream() != null) {
try { try {
String message = GdbPlugin.getDebugTime() + " " + finalLine + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ String message = GdbPlugin.getDebugTime() + " " + finalLine + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
@ -636,8 +630,6 @@ public abstract class AbstractMIControl extends AbstractDsfService
setMITracingStream(null); setMITracingStream(null);
} }
} }
}
});
processMIOutput(line); processMIOutput(line);
} }