From: michael Date: Sun, 25 Feb 2007 14:10:06 +0000 (+0000) Subject: be a bit more intelligent in 'interrupt' handling X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/usb-driver/commitdiff_plain/9ba1e383d177b48326c864f7b06b6934ff3f779d be a bit more intelligent in 'interrupt' handling --- diff --git a/usb-driver.c b/usb-driver.c index 0bf6e81..be08eff 100644 --- a/usb-driver.c +++ b/usb-driver.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "usb-driver.h" static int (*ioctl_func) (int, int, void *) = NULL; @@ -330,6 +331,7 @@ int do_wdioctl(int fd, unsigned int request, unsigned char *wdioctl) { it->dwLost, it->fStopped); it->fEnableOk = 1; + it->fStopped = 0; ints_enabled = 1; pthread_mutex_trylock(&int_wait); } @@ -351,7 +353,8 @@ int do_wdioctl(int fd, unsigned int request, unsigned char *wdioctl) { it->dwCounter = 0; it->fStopped = 1; ints_enabled = 0; - pthread_mutex_unlock(&int_wait); + if (pthread_mutex_trylock(&int_wait) == EBUSY) + pthread_mutex_unlock(&int_wait); #endif DPRINTF("Handle: %lu, Options: %lx, ncmds: %lu, enableok: %lu, count: %lu, lost: %lu, stopped: %lu\n", it->hInterrupt, it->dwOptions,