public void removeEventListener ( ) { logger . fine ( "RXTXPort:removeEventListener() called" ) ; waitForTheNativeCodeSilly ( ) ; //if( monThread != null && monThread.isAlive() ) if ( monThreadisInterrupted == true ) { logger . fine ( " RXTXPort:removeEventListener() already interrupted" ) ; monThread = null ; SPEventListener = null ; return ; } else if ( monThread != null && monThread . isAlive ( ) ) { logger . fine ( " RXTXPort:Interrupt=true" ) ; monThreadisInterrupted = true ; /* Notify all threads in this PID that something is up They will call back to see if its their thread using isInterrupted(). */ logger . fine ( " RXTXPort:calling interruptEventLoop" ) ; interruptEventLoop ( ) ; logger . fine ( " RXTXPort:calling monThread.join()" ) ; try { // wait a reasonable moment for the death of the monitor thread monThread . join ( 3000 ) ; } catch ( InterruptedException ex ) { // somebody called interrupt() on us (ie wants us to abort) // we dont propagate InterruptedExceptions so lets re-set the flag Thread . currentThread ( ) . interrupt ( ) ; return ; } { logger . fine ( " MonThread is still alive!" ) ; } } monThread = null ; SPEventListener = null ; MonitorThreadLock = false ; MonitorThreadAlive = false ; monThreadisInterrupted = true ; logger . fine ( "RXTXPort:removeEventListener() returning" ) ; }
Remove the serial port event listener