summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2020-01-20 10:49:07 +0000
committerRichard Hughes <richard@hughsie.com>2020-01-20 11:13:16 +0000
commit17f9cda073459fc673a99bd281e929a999643374 (patch)
tree09709ae7da645a7569775c6db44472f822bf8260
parent575dfa6e143c10feaa5b168fba97504ac0d39723 (diff)
downloadgusb-17f9cda073459fc673a99bd281e929a999643374.tar.gz
Fix high number of wakeups when checking the GUsbContext
In 985b9e4ec39ac521e7398a8e3017c96f2c4d75ec I mistakenly thought this was the timeout for the added/removed context checking, which was Windows-specific. It actually was the main context event thread, which is running all the time. Switch the poll timeout to be 2s, (still down from the default 60s!) which is a better compromise between battery life and context shutdown performance. Fixes https://github.com/hughsie/libgusb/issues/24
-rw-r--r--gusb/gusb-context.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gusb/gusb-context.c b/gusb/gusb-context.c
index 868676e..93c33c5 100644
--- a/gusb/gusb-context.c
+++ b/gusb/gusb-context.c
@@ -579,8 +579,8 @@ 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,
+ .tv_usec = 0,
+ .tv_sec = 2,
};
while (g_atomic_int_get (&priv->thread_event_run) > 0)