Skip to content

Commit

Permalink
#1364 Enhancements to resolve issue with tuner shutdown hang on appli…
Browse files Browse the repository at this point in the history
…cation shutdown.
  • Loading branch information
Dennis Sheirer committed Dec 18, 2022
1 parent dc327a2 commit 0b19efb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -643,9 +643,14 @@ public void processTransfer(Transfer transfer)
default:
//Unexpected transfer error - need to reset the bulk transfer interface
transfer.buffer().rewind();
setErrorMessage("LibUsb Transfer Error - stopping device - status [" + transfer.status() + "] - " +
LibUsb.errorName(transfer.status()));
return;

//Only set an error if we're not shutting down
if(mAutoResubmitTransfers)
{
setErrorMessage("LibUsb Transfer Error - stopping device - status [" + transfer.status() + "] - " +
LibUsb.errorName(transfer.status()));
}
break;
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/main/java/io/github/dsheirer/util/Dispatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ public void stop()

try
{
mThread.join(2000);
mThread.interrupt();
mThread.join();
mThread = null;
}
catch(Exception e)
Expand Down Expand Up @@ -183,14 +184,15 @@ else if(element != null)
}
catch(InterruptedException e)
{
mLog.error("Buffer processor thread was interrupted");
//Normal shutdown is by interrupt
}
catch(Exception e)
{
mLog.error("Error while processing element", e);
}
}

//Shutting down - clear the queue
mQueue.clear();
}
catch(Throwable t)
Expand Down

0 comments on commit 0b19efb

Please sign in to comment.