summaryrefslogtreecommitdiff
path: root/libusb/sync.c
diff options
context:
space:
mode:
Diffstat (limited to 'libusb/sync.c')
-rw-r--r--libusb/sync.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libusb/sync.c b/libusb/sync.c
index 27b5951..146cce2 100644
--- a/libusb/sync.c
+++ b/libusb/sync.c
@@ -34,10 +34,15 @@
static void LIBUSB_CALL sync_transfer_cb(struct libusb_transfer *transfer)
{
+ usbi_dbg(TRANSFER_CTX(transfer), "actual_length=%d", transfer->actual_length);
+
int *completed = transfer->user_data;
*completed = 1;
- usbi_dbg(TRANSFER_CTX(transfer), "actual_length=%d", transfer->actual_length);
- /* caller interprets result and frees transfer */
+ /*
+ * Right after setting 'completed', another thread might free the transfer, so don't
+ * access it beyond this point. The instantiating thread (not necessarily the
+ * current one) interprets the result and frees the transfer.
+ */
}
static void sync_transfer_wait_for_completion(struct libusb_transfer *transfer)