diff options
author | Richard Hughes <richard@hughsie.com> | 2019-11-28 18:35:58 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2019-12-03 16:16:17 +0000 |
commit | 985b9e4ec39ac521e7398a8e3017c96f2c4d75ec (patch) | |
tree | 0190b6113ad2ed8bf81af4878ce161862322160d | |
parent | 46724c359f293faab893986870907194c16ec68e (diff) | |
download | gusb-985b9e4ec39ac521e7398a8e3017c96f2c4d75ec.tar.gz |
Use a 1ms timeout in the Windows event thread
This avoids blocking for multiple seconds when trying to destroy the context,
which could happen quite a few times in the self tests.
-rw-r--r-- | gusb/gusb-context.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gusb/gusb-context.c b/gusb/gusb-context.c index dd7fb0c..868676e 100644 --- a/gusb/gusb-context.c +++ b/gusb/gusb-context.c @@ -578,9 +578,13 @@ g_usb_context_event_thread_cb (gpointer data) { GUsbContext *context = G_USB_CONTEXT (data); GUsbContextPrivate *priv = context->priv; + struct timeval tv = { + .tv_sec = 0, + .tv_usec = 1000, + }; while (g_atomic_int_get (&priv->thread_event_run) > 0) - libusb_handle_events (priv->ctx); + libusb_handle_events_timeout_completed (priv->ctx, &tv, NULL); return NULL; } |