Browse Source

Reuse old MTX Handle

nfactor-troky
Kano 12 years ago
parent
commit
6041be6142
  1. 14
      usbutils.c

14
usbutils.c

@ -2626,8 +2626,8 @@ static bool resource_lock(const char *dname, uint8_t bus_number, uint8_t device_
return true; return true;
fail: fail:
sec = unsec(sec);
CloseHandle(usbMutex); CloseHandle(usbMutex);
sec = unsec(sec);
return false; return false;
#else #else
struct semid_ds seminfo; struct semid_ds seminfo;
@ -2730,14 +2730,6 @@ static void resource_unlock(const char *dname, uint8_t bus_number, uint8_t devic
if (!usbMutex || !sec) if (!usbMutex || !sec)
goto fila; goto fila;
usbMutex = CreateMutex(sec, FALSE, name);
if (usbMutex == NULL) {
applog(LOG_ERR,
"MTX: %s USB failed to get '%s' for release err (%d)",
dname, name, GetLastError());
goto fila;
}
if (!ReleaseMutex(usbMutex)) if (!ReleaseMutex(usbMutex))
applog(LOG_ERR, applog(LOG_ERR,
"MTX: %s USB failed to release '%s' err (%d)", "MTX: %s USB failed to release '%s' err (%d)",
@ -2745,10 +2737,10 @@ static void resource_unlock(const char *dname, uint8_t bus_number, uint8_t devic
fila: fila:
if (sec)
unsec(sec);
if (usbMutex) if (usbMutex)
CloseHandle(usbMutex); CloseHandle(usbMutex);
if (sec)
unsec(sec);
remove_in_use(bus_number, device_address); remove_in_use(bus_number, device_address);
return; return;
#else #else

Loading…
Cancel
Save