mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
Bug 333613 - [terminal] "Job found still running" message on stdout console after terminating Eclipse
This commit is contained in:
parent
b05f03a7c8
commit
f097643ed1
2 changed files with 33 additions and 23 deletions
|
@ -27,6 +27,7 @@
|
|||
* Michael Scharf (Wind River) - [240098] The cursor should not blink when the terminal is disconnected
|
||||
* Anton Leherbauer (Wind River) - [335021] Middle mouse button copy/paste does not work with the terminal
|
||||
* Max Stepanov (Appcelerator) - [339768] Fix ANSI code for PgUp / PgDn
|
||||
* Pawel Piech (Wind River) - [333613] "Job found still running" after shutdown
|
||||
*******************************************************************************/
|
||||
package org.eclipse.tm.internal.terminal.emulator;
|
||||
|
||||
|
@ -346,27 +347,33 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
|
|||
public void disconnectTerminal() {
|
||||
Logger.log("entered."); //$NON-NLS-1$
|
||||
|
||||
//Ensure that a new Job can be started; then clean up old Job.
|
||||
//TODO not sure whether the fInputStream needs to be cleaned too,
|
||||
//or whether the Job could actually cancel in case the fInputStream is closed.
|
||||
Job job;
|
||||
synchronized(this) {
|
||||
job = fJob;
|
||||
fJob = null;
|
||||
}
|
||||
if (job!=null) {
|
||||
job.cancel();
|
||||
// Join job to avoid leaving job running after workbench shutdown (333613).
|
||||
try {
|
||||
fInputStream.close();
|
||||
job.join();
|
||||
} catch (IOException e1) {
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
// Thread t = job.getThread();
|
||||
// if(t!=null) t.interrupt();
|
||||
}
|
||||
|
||||
if (getState()==TerminalState.CLOSED) {
|
||||
return;
|
||||
}
|
||||
if(getTerminalConnector()!=null) {
|
||||
getTerminalConnector().disconnect();
|
||||
}
|
||||
//Ensure that a new Job can be started; then clean up old Job.
|
||||
//TODO not sure whether the fInputStream needs to be cleaned too,
|
||||
//or whether the Job could actually cancel in case the fInputStream is closed.
|
||||
Job job;
|
||||
synchronized(this) {
|
||||
job = fJob;
|
||||
fJob = null;
|
||||
}
|
||||
if (job!=null) {
|
||||
job.cancel();
|
||||
//There's not really a need to interrupt, since the job will
|
||||
//check its cancel status after 500 msec latest anyways...
|
||||
//Thread t = job.getThread();
|
||||
//if(t!=null) t.interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 1996, 2008 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 1996, 2011 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -10,6 +10,7 @@
|
|||
* Douglas Lea (Addison Wesley) - [cq:1552] BoundedBufferWithStateTracking adapted to BoundedByteBuffer
|
||||
* Martin Oberhuber (Wind River) - the waitForAvailable method
|
||||
* Martin Oberhuber (Wind River) - [208166] Avoid unnecessary arraycopy in BoundedByteBuffer
|
||||
* Pawel Piech (Wind River) - [333613] "Job found still running" after shutdown
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.tm.internal.terminal.textcanvas;
|
||||
|
@ -72,7 +73,7 @@ public class PipedInputStream extends InputStream {
|
|||
* Must be called with a lock on this!
|
||||
*/
|
||||
public int available() {
|
||||
return fUsedSlots;
|
||||
return fUsedSlots;
|
||||
}
|
||||
/**
|
||||
* Writes a single byte to the buffer. Blocks if the buffer is full.
|
||||
|
@ -231,13 +232,13 @@ public class PipedInputStream extends InputStream {
|
|||
*/
|
||||
public void waitForAvailable(long millis) throws InterruptedException {
|
||||
synchronized(fQueue) {
|
||||
if(fQueue.available()==0)
|
||||
if(fQueue.available()==0 && !fQueue.fClosed)
|
||||
fQueue.wait(millis);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Must be called in the Display Thread!
|
||||
* @return true if a character is available for the terminal to show.
|
||||
* @return number of characters available for reading.
|
||||
*/
|
||||
public int available() {
|
||||
synchronized(fQueue) {
|
||||
|
@ -259,12 +260,14 @@ public class PipedInputStream extends InputStream {
|
|||
}
|
||||
}
|
||||
/**
|
||||
* Closing a <tt>PipedInputStream</tt> has no effect. The methods in
|
||||
* this class can be called after the stream has been closed without
|
||||
* generating an <tt>IOException</tt>.
|
||||
* <p>
|
||||
* Closing a <tt>PipedInputStream</tt> is the same as closing the output stream.
|
||||
* The stream will allow reading data that's still in the pipe after which it will
|
||||
* throw an <tt>IOException</tt>.
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
synchronized(fQueue) {
|
||||
fQueue.close();
|
||||
}
|
||||
}
|
||||
|
||||
public int read(byte[] cbuf, int off, int len) throws IOException {
|
||||
|
|
Loading…
Add table
Reference in a new issue