Release the read lock in a finally block
@@ -469,6 +469,7 @@ public class TerminalOutput implements ClientOutput {
try {
while (!closing) {
if (readInput.readLock().tryLock(10, TimeUnit.MILLISECONDS)) {
+ try {
int c = terminal.reader().read(10);
if (c == -1) {
break;
@@ -476,9 +477,11 @@ public class TerminalOutput implements ClientOutput {
if (c == KEY_PLUS || c == KEY_MINUS || c == KEY_CTRL_L || c == KEY_CTRL_M || c == KEY_CTRL_B) {
daemonReceive.accept(Message.keyboardInput((char) c));
}
+ } finally {
readInput.readLock().unlock();
}
}
+ }
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (InterruptedIOException e) {
