]> sigrok.org Git - libsigrok.git/commitdiff
Windows usb: don't try to resume thread if shut down in callback.
authorMartin Ling <redacted>
Sun, 22 Dec 2013 17:38:24 +0000 (17:38 +0000)
committerMartin Ling <redacted>
Sun, 22 Dec 2013 17:38:24 +0000 (17:38 +0000)
hardware/common/usb.c

index c4d78f90a236acd036c4ad7e60a1ea902f225fa1..0de54b90653d86f56bb1d58cf8f890ba6bdc1d2a 100644 (file)
@@ -267,8 +267,11 @@ SR_PRIV int usb_callback(int fd, int revents, void *cb_data)
 
        g_mutex_lock(&ctx->usb_mutex);
        ret = ctx->usb_cb(fd, revents, ctx->usb_cb_data);
-       ResetEvent(ctx->usb_event);
-       g_mutex_unlock(&ctx->usb_mutex);
+
+       if (ctx->usb_thread_running) {
+               ResetEvent(ctx->usb_event);
+               g_mutex_unlock(&ctx->usb_mutex);
+       }
 
        return ret;
 }