#1364 Enhancements to resolve issue with tuner shutdown hang on application shutdown. (#1365)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2022-12-18 04:29:55 -05:00
committed by GitHub
parent dc327a2855
commit 4a68cd9407
2 changed files with 12 additions and 5 deletions

View File

@@ -643,9 +643,14 @@ public abstract class USBTunerController extends TunerController
default: default:
//Unexpected transfer error - need to reset the bulk transfer interface //Unexpected transfer error - need to reset the bulk transfer interface
transfer.buffer().rewind(); transfer.buffer().rewind();
setErrorMessage("LibUsb Transfer Error - stopping device - status [" + transfer.status() + "] - " +
LibUsb.errorName(transfer.status())); //Only set an error if we're not shutting down
return; if(mAutoResubmitTransfers)
{
setErrorMessage("LibUsb Transfer Error - stopping device - status [" + transfer.status() + "] - " +
LibUsb.errorName(transfer.status()));
}
break;
} }
} }

View File

@@ -122,7 +122,8 @@ public class Dispatcher<E> implements Listener<E>
try try
{ {
mThread.join(2000); mThread.interrupt();
mThread.join();
mThread = null; mThread = null;
} }
catch(Exception e) catch(Exception e)
@@ -183,7 +184,7 @@ public class Dispatcher<E> implements Listener<E>
} }
catch(InterruptedException e) catch(InterruptedException e)
{ {
mLog.error("Buffer processor thread was interrupted"); //Normal shutdown is by interrupt
} }
catch(Exception e) catch(Exception e)
{ {
@@ -191,6 +192,7 @@ public class Dispatcher<E> implements Listener<E>
} }
} }
//Shutting down - clear the queue
mQueue.clear(); mQueue.clear();
} }
catch(Throwable t) catch(Throwable t)