-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
After cancelling transfers, wait for all handling to complete.
Calling libusb_cancel_transfer only starts the cancellation of a transfer. The process is not complete until the transfer callback has been called with status LIBUSB_TRANSFER_CANCELLED. If hackrf_start_rx() is called soon after hackrf_stop_rx(), prepare_transfers() may be called before the previous cancellations are completed, resulting in a LIBUSB_ERROR_BUSY when a transfer is reused with libusb_submit_transfer(). To prevent this happening, we keep track of which transfers have finished (either by completion, or cancellation), and make cancel_transfers() wait until all transfers are finished. This is implemented using a pthread condition variable which is signalled from the transfer thread.
- Loading branch information
1 parent
b346790
commit 9182f1c
Showing
1 changed file
with
78 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters