diff options
| author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2018-09-28 10:28:22 +0000 |
|---|---|---|
| committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2018-09-28 10:28:22 +0000 |
| commit | 26829924835117b52d971fa58b9967e676cb246d (patch) | |
| tree | fd9475144f75bf912bc055238d32414775065c3e /lib/libusb | |
| parent | d0addc700eee2b9866d1cfaf17ac45abc68d9a54 (diff) | |
Notes
Diffstat (limited to 'lib/libusb')
| -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 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); |
