From 8cec8d03dd15f2fe68d2f7406eaffc5e1e363007 Mon Sep 17 00:00:00 2001 From: Rey Tucker Date: Mon, 7 Aug 2017 11:35:16 -0400 Subject: [PATCH] host/libbladeRF/cyapi: ReleaseMutex before CloseHandle When working on mutexes for the libusb backend, I noticed that I needed to ReleaseMutex() when closing the device, or else that device would not be usable again until all of the mutexes were released. I have not tested this with CyAPI as yet, but I believe the same problem will occur, and I also believe this may fix it. --- host/libraries/libbladeRF/src/backend/usb/cyapi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/host/libraries/libbladeRF/src/backend/usb/cyapi.c b/host/libraries/libbladeRF/src/backend/usb/cyapi.c index d0313f7e..1de0664a 100644 --- a/host/libraries/libbladeRF/src/backend/usb/cyapi.c +++ b/host/libraries/libbladeRF/src/backend/usb/cyapi.c @@ -249,6 +249,7 @@ static int open_via_info(void **driver, backend_probe_target probe_target, if (status != 0) { delete dev; + ReleaseMutex(cyapi_data->mutex); CloseHandle(cyapi_data->mutex); } @@ -281,6 +282,7 @@ static void cyapi_close(void *driver) struct bladerf_cyapi *cyapi_data = get_backend_data(driver); cyapi_data->dev->Close(); delete cyapi_data->dev; + ReleaseMutex(cyapi_data->mutex); CloseHandle(cyapi_data->mutex); free(driver);