From: Martin Ling Date: Sun, 22 Dec 2013 17:38:24 +0000 (+0000) Subject: Windows usb: don't try to resume thread if shut down in callback. X-Git-Tag: libsigrok-0.3.0~416 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=34ea7f9695794ea4654b26dd4aa6b79cdee90b71;p=libsigrok.git Windows usb: don't try to resume thread if shut down in callback. --- diff --git a/hardware/common/usb.c b/hardware/common/usb.c index c4d78f90..0de54b90 100644 --- a/hardware/common/usb.c +++ b/hardware/common/usb.c @@ -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; }