Continually try to force-interrupt an event thread if it does not join in a timely fashion
This commit is contained in:
parent
a9444ffbad
commit
faffe075c8
|
@ -2,7 +2,7 @@
|
||||||
* SerialPort.java
|
* SerialPort.java
|
||||||
*
|
*
|
||||||
* Created on: Feb 25, 2012
|
* Created on: Feb 25, 2012
|
||||||
* Last Updated on: Jan 28, 2022
|
* Last Updated on: Feb 14, 2022
|
||||||
* Author: Will Hedgecock
|
* Author: Will Hedgecock
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2022 Fazecast, Inc.
|
* Copyright (C) 2012-2022 Fazecast, Inc.
|
||||||
|
@ -1765,10 +1765,12 @@ public final class SerialPort
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
serialEventThread.join(500);
|
do
|
||||||
if (serialEventThread.isAlive())
|
{
|
||||||
serialEventThread.interrupt();
|
serialEventThread.join(500);
|
||||||
serialEventThread.join();
|
if (serialEventThread.isAlive())
|
||||||
|
serialEventThread.interrupt();
|
||||||
|
} while (serialEventThread.isAlive());
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) { Thread.currentThread().interrupt(); }
|
catch (InterruptedException e) { Thread.currentThread().interrupt(); }
|
||||||
serialEventThread = null;
|
serialEventThread = null;
|
||||||
|
|
Loading…
Reference in New Issue