From e2482f2bc6e0eaa24f5b15a71ace482e699ffa4e Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Mon, 2 Feb 2004 14:18:09 +0000 Subject: [PATCH] Do not pass an empty string. --- .../eclipse/cdt/debug/mi/core/TxThread.java | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/TxThread.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/TxThread.java index d5857b04644..97a4beb776d 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/TxThread.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/TxThread.java @@ -41,28 +41,37 @@ public class TxThread extends Thread { } if (cmd != null) { - // Move to the RxQueue only if RxThread is alive. - Thread rx = session.getRxThread(); - if (rx != null && rx.isAlive()) { - CommandQueue rxQueue = session.getRxQueue(); - rxQueue.addCommand(cmd); + String str = cmd.toString(); + // if string is empty consider as a noop + if (str.length() > 0) { + // Move to the RxQueue only if RxThread is alive. + Thread rx = session.getRxThread(); + if (rx != null && rx.isAlive()) { + CommandQueue rxQueue = session.getRxQueue(); + rxQueue.addCommand(cmd); + } else { + // The RxThread is not running + synchronized (cmd) { + cmd.notifyAll(); + } + } + + // Process the Command line to recognise patterns we may need to fire event. + if (cmd instanceof CLICommand) { + cli.process((CLICommand)cmd); + } + + // shove in the pipe + if (out != null) { + out.write(str.getBytes()); + out.flush(); + } } else { + // String is empty consider as a noop synchronized (cmd) { cmd.notifyAll(); } } - - // May need to fire event. - if (cmd instanceof CLICommand) { - cli.process((CLICommand)cmd); - } - - // shove in the pipe - String str = cmd.toString(); - if (out != null && str.length() > 0) { - out.write(str.getBytes()); - out.flush(); - } } } } catch (IOException e) {