diff options
| author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2018-10-05 07:50:44 +0000 |
|---|---|---|
| committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2018-10-05 07:50:44 +0000 |
| commit | 2e0467d40137d761c42fc75a7ded761ba49a463b (patch) | |
| tree | aaa3a17c92e2eccfa6d1fa1d0b6a39f0868a15c0 | |
| parent | 82101a443a8696240cba3e59830470bab553bb1b (diff) | |
Notes
| -rw-r--r-- | lib/libusb/libusb10_io.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libusb/libusb10_io.c b/lib/libusb/libusb10_io.c index 3b763ec9acb6..315297f10f2d 100644 --- a/lib/libusb/libusb10_io.c +++ b/lib/libusb/libusb10_io.c @@ -310,6 +310,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); @@ -328,6 +331,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); |
