Ensure that event listener thread does not join on itself
This commit is contained in:
parent
96a47bcad8
commit
ea3c593776
|
@ -1759,10 +1759,11 @@ public final class SerialPort
|
||||||
configTimeouts(portHandle, TIMEOUT_NONBLOCKING, 0, 0, 0);
|
configTimeouts(portHandle, TIMEOUT_NONBLOCKING, 0, 0, 0);
|
||||||
setEventListeningStatus(portHandle, false);
|
setEventListeningStatus(portHandle, false);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Wait until the event-reading thread returns. This thread MUST return or the serial port will
|
// Wait until the event-reading thread returns. This thread MUST return or the serial port will
|
||||||
// be in an unspecified, possibly unrecoverable state
|
// be in an unspecified, possibly unrecoverable state
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!Thread.currentThread().equals(serialEventThread))
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
serialEventThread.join(500);
|
serialEventThread.join(500);
|
||||||
|
|
Loading…
Reference in New Issue