aboutsummaryrefslogtreecommitdiff
path: root/lib/libusb
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2018-09-28 10:28:22 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2018-09-28 10:28:22 +0000
commit26829924835117b52d971fa58b9967e676cb246d (patch)
treefd9475144f75bf912bc055238d32414775065c3e /lib/libusb
parentd0addc700eee2b9866d1cfaf17ac45abc68d9a54 (diff)
Notes
Diffstat (limited to 'lib/libusb')
-rw-r--r--lib/libusb/libusb10_io.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libusb/libusb10_io.c b/lib/libusb/libusb10_io.c
index 13c9e786c00e..53f5b040436d 100644
--- a/lib/libusb/libusb10_io.c
+++ b/lib/libusb/libusb10_io.c
@@ -312,6 +312,9 @@ libusb_wait_for_event(libusb_context *ctx, struct timeval *tv)
if (tv == NULL) {
pthread_cond_wait(&ctx->ctx_cond,
&ctx->ctx_lock);
+ /* try to grab polling of actual events, if any */
+ if (ctx->ctx_handler == NO_THREAD)
+ ctx->ctx_handler = pthread_self();
return (0);
}
err = clock_gettime(CLOCK_MONOTONIC, &ts);
@@ -330,6 +333,9 @@ libusb_wait_for_event(libusb_context *ctx, struct timeval *tv)
}
err = pthread_cond_timedwait(&ctx->ctx_cond,
&ctx->ctx_lock, &ts);
+ /* try to grab polling of actual events, if any */
+ if (ctx->ctx_handler == NO_THREAD)
+ ctx->ctx_handler = pthread_self();
if (err == ETIMEDOUT)
return (1);