while (running) {
while (InputMidi==thisThread) {
		public void run () {			running = true;			byte i;			while (running) {				try {					if (inStream[currentInPort]==null)						break;					while (running) {						/* TODO I imagine that this might be chewing up a lot of CPU time if it's						 * contantly polling. We might want to add something here where that does						 * a short sleep() if this loop cycles some number of times without seeing						 * any input. - emenaker 2003.03.12						 */						i=(byte)inStream[currentInPort].read ();						if ((i!=-1)&&(i!=-2)&&(i!=0xFE) && (i!=0xF8)) {    //Ignore Active Sensing & Timing							midiBuffer[writePos]=i;writePos++;							writePos%=bufferSize;						}					}				} catch (Exception ex) {					System.out.println ("Error");				}			}		}