1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +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
// 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
// we must use -thread-select and -stack-select-frame
private int fCurrentStackLevel = -1;
@ -142,14 +142,14 @@ public abstract class AbstractMIControl extends AbstractDsfService
* to disable tracing.
* @since 2.0
*/
protected void setMITracingStream(OutputStream tracingStream) {
protected synchronized void setMITracingStream(OutputStream tracingStream) {
fTracingStream = tracingStream;
}
/**
* Returns the MI tracing stream.
*/
private OutputStream getMITracingStream() {
private synchronized OutputStream getMITracingStream() {
return fTracingStream;
}
@ -564,8 +564,6 @@ public abstract class AbstractMIControl extends AbstractDsfService
fOutputStream.flush();
GdbPlugin.debug(GdbPlugin.getDebugTime() + MI_TRACE_IDENTIFIER + str);
getExecutor().execute(new DsfRunnable() {
public void run() {
if (getMITracingStream() != null) {
try {
String message = GdbPlugin.getDebugTime() + " " + str; //$NON-NLS-1$
@ -583,8 +581,6 @@ public abstract class AbstractMIControl extends AbstractDsfService
}
}
}
});
}
} catch (IOException e) {
// Shutdown thread in case of IO error.
break;
@ -618,8 +614,6 @@ public abstract class AbstractMIControl extends AbstractDsfService
GdbPlugin.debug(GdbPlugin.getDebugTime() + MI_TRACE_IDENTIFIER + line + "\n"); //$NON-NLS-1$
final String finalLine = line;
getExecutor().execute(new DsfRunnable() {
public void run() {
if (getMITracingStream() != null) {
try {
String message = GdbPlugin.getDebugTime() + " " + finalLine + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
@ -636,8 +630,6 @@ public abstract class AbstractMIControl extends AbstractDsfService
setMITracingStream(null);
}
}
}
});
processMIOutput(line);
}