1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 07:17:58 +00:00

Lock mutex before second pthread_cond_wait in usbutils to prevent a race.

This commit is contained in:
Con Kolivas 2013-10-14 00:54:05 +11:00
parent 84de52c1c6
commit 280dc4bf01

View File

@ -2237,6 +2237,7 @@ static int callback_wait(struct usb_transfer *ut, int *transferred, unsigned int
libusb_cancel_transfer(transfer); libusb_cancel_transfer(transfer);
/* Now wait for the callback function to be invoked. */ /* Now wait for the callback function to be invoked. */
mutex_lock(&ut->mutex);
pthread_cond_wait(&ut->cond, &ut->mutex); pthread_cond_wait(&ut->cond, &ut->mutex);
} }
ret = transfer->status; ret = transfer->status;