Extend scope of transfer_lock in callback.
This commit is contained in:
@ -1834,15 +1834,10 @@ hackrf_libusb_transfer_callback(struct libusb_transfer* usb_transfer)
|
|||||||
device->streaming = false;
|
device->streaming = false;
|
||||||
device->flush = false;
|
device->flush = false;
|
||||||
}
|
}
|
||||||
// Now we can release the lock. Our transfer was either
|
|
||||||
// cancelled or restarted, not both.
|
|
||||||
pthread_mutex_unlock(&device->transfer_lock);
|
|
||||||
|
|
||||||
// If a data transfer was resubmitted successfully, we're done.
|
// If a data transfer was resubmitted successfully, we're done.
|
||||||
if (resubmit && result == LIBUSB_SUCCESS)
|
if (!resubmit || result != LIBUSB_SUCCESS) {
|
||||||
return;
|
// No further calls should be made to the TX callback.
|
||||||
|
|
||||||
// Otherwise, no further calls should be made to the TX callback.
|
|
||||||
device->streaming = false;
|
device->streaming = false;
|
||||||
|
|
||||||
// If this is the last transfer, signal that all are now finished.
|
// If this is the last transfer, signal that all are now finished.
|
||||||
@ -1858,6 +1853,11 @@ hackrf_libusb_transfer_callback(struct libusb_transfer* usb_transfer)
|
|||||||
pthread_mutex_unlock(&device->all_finished_lock);
|
pthread_mutex_unlock(&device->all_finished_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now we can release the lock. Our transfer was either
|
||||||
|
// cancelled or restarted, not both.
|
||||||
|
pthread_mutex_unlock(&device->transfer_lock);
|
||||||
|
}
|
||||||
|
|
||||||
static int kill_transfer_thread(hackrf_device* device)
|
static int kill_transfer_thread(hackrf_device* device)
|
||||||
{
|
{
|
||||||
void* value;
|
void* value;
|
||||||
|
Reference in New Issue
Block a user