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->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 (resubmit && result == LIBUSB_SUCCESS)
|
||||
return;
|
||||
|
||||
// Otherwise, no further calls should be made to the TX callback.
|
||||
if (!resubmit || result != LIBUSB_SUCCESS) {
|
||||
// No further calls should be made to the TX callback.
|
||||
device->streaming = false;
|
||||
|
||||
// If this is the last transfer, signal that all are now finished.
|
||||
@ -1856,6 +1851,11 @@ hackrf_libusb_transfer_callback(struct libusb_transfer* usb_transfer)
|
||||
device->active_transfers--;
|
||||
}
|
||||
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)
|
||||
|
Reference in New Issue
Block a user