airspy / airspyone_host

AirSpy's usemode driver and associated tools
http://airspy.com
247 stars 88 forks source link

Use device->stop_requested when libusb errors out #76

Closed johanhedin closed 3 years ago

johanhedin commented 3 years ago

Replace device->streaming = false with device->stop_requested = true for USB errors to avoid deadlock on device removal. Also check stop_requested when checking if streaming or not to be consistent with the old behavior.

This is another take on issue #74 instead of pull request #75.

bvernoux commented 3 years ago

Thanks for your contribution It seems to be the best compromise with minimal impact on code

Could you share you results ? (does it fix fully the issue on your side)

johanhedin commented 3 years ago

Could you share you results ? (does it fix fully the issue on your side)

Running the test program I attached in #74 against master will deadlock 10 out of 10 times when pulling the device. Running the same program against this branch of libairspy never show the deadlock.

Always difficult with threads and synchronization, but I would say that this patch fully fix the deadlock issue that I have seen.