Clear streaming flag in transfer_finished().
by Martin Ling 3 years 9 months
Clear streaming flag in transfer_finished().

Since we always do these together, move it into the function.
54e00de1
Clear streaming flag if a transfer was cancelled.
by Martin Ling 3 years 9 months
Clear streaming flag if a transfer was cancelled.

If a transfer was cancelled, we are on our way to shutdown.

If hackrf_stop_tx() or hackrf_stop_rx() were called, they will already
have cleared this flag, but it is not cleared in hackrf_close(), and
for consistency with other paths it makes sense to clear it here.
6bd9cb05
Don't call callback or submit new transfers once s...
by Martin Ling 3 years 9 months
Don't call callback or submit new transfers once streaming stops.

This stops the RX callback from being called again with further data
once it has returned nonzero, or after a transfer had an error status.
125bf9f7
Clear streaming flag if we didn't resubmit a trans...
by Martin Ling 3 years 9 months
Clear streaming flag if we didn't resubmit a transfer.

If result < 0 here, libusb_submit_transfer returned an error, so we
need to shut down.

If !resubmit, then cancel_transfers() was already called by one of the
stop or close functions, so streaming is already false.
6720e56f
Don't exit transfer thread if an error occurs.
by Martin Ling 3 years 9 months
Don't exit transfer thread if an error occurs.

In the case of a libusb error, we still need the transfer thread
running, in order to handle outstanding cancellations and to signal the
condition variable when that is done.
9e1cb5c0
Merge pull request #1067 from Matioupi/master
by Martin Ling 3 years 9 months
Merge pull request #1067 from Matioupi/master

proposal to fix regression in 4c9fcf86651232c2104b57510a0ac86cf86123e4 #1057
d3e4e9b6
fix regression in 4c9fcf86651232c2104b57510a0ac86c...
by Mathieu Peyréga 3 years 9 months
fix regression in 4c9fcf86651232c2104b57510a0ac86cf86123e4
a8a66187
Merge pull request #1063 from metayan/fast-exit
by Martin Ling 3 years 9 months
Merge pull request #1063 from metayan/fast-exit

Ensure fast exit
8b9a33d4
Cleaner fast exit
by Yan 3 years 9 months
Cleaner fast exit

Interrupt the event handling thread instead of waiting for timeout.
790de7f4
Ensure fast exit
by Yan 3 years 9 months
Ensure fast exit

transfer_threadproc has a timeout of half a second, so
when kill_transfer_thread tries to pthread_join, it often
has to wait until the timeout kicks in.

With this fix, we ensure that a final request is made after
request_exit has been called, so that transfer_threadproc can exit its
loop in a fast and clean manner.
7ff92b3b
Report a bug