From 8d1604a2e3c70f4aacaef32bc265ce9b7aff36c1 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 14 Oct 2013 09:40:23 +1100 Subject: [PATCH] Do not use locking on usb callback function pthread signalling to prevent deadlock with libusb's own event lock. --- usbutils.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/usbutils.c b/usbutils.c index 03fac7d1..549db214 100644 --- a/usbutils.c +++ b/usbutils.c @@ -2248,9 +2248,7 @@ static void LIBUSB_CALL transfer_callback(struct libusb_transfer *transfer) { struct usb_transfer *ut = transfer->user_data; - mutex_lock(&ut->mutex); pthread_cond_signal(&ut->cond); - mutex_unlock(&ut->mutex); } /* Wait for callback function to tell us it has finished the USB transfer, but @@ -2272,7 +2270,6 @@ static int callback_wait(struct usb_transfer *ut, int *transferred, unsigned int libusb_cancel_transfer(transfer); /* Now wait for the callback function to be invoked. */ - mutex_lock(&ut->mutex); pthread_cond_wait(&ut->cond, &ut->mutex); } ret = transfer->status;