diff options
Diffstat (limited to 'libusb/core.c')
-rw-r--r-- | libusb/core.c | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/libusb/core.c b/libusb/core.c index c992747..997368a 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -1180,39 +1180,10 @@ void usbi_fd_notification(struct libusb_context *ctx) unsigned char dummy = 1; ssize_t r; - if (ctx == NULL) - return; - - /* record that we are messing with poll fds */ - usbi_mutex_lock(&ctx->pollfd_modify_lock); - ctx->pollfd_modify++; - usbi_mutex_unlock(&ctx->pollfd_modify_lock); - /* write some data on control pipe to interrupt event handlers */ r = usbi_write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy)); - if (r <= 0) { + if (r != sizeof(dummy)) usbi_warn(ctx, "internal signalling write failed"); - usbi_mutex_lock(&ctx->pollfd_modify_lock); - ctx->pollfd_modify--; - usbi_mutex_unlock(&ctx->pollfd_modify_lock); - return; - } - - /* take event handling lock */ - libusb_lock_events(ctx); - - /* read the dummy data */ - r = usbi_read(ctx->ctrl_pipe[0], &dummy, sizeof(dummy)); - if (r <= 0) - usbi_warn(ctx, "internal signalling read failed"); - - /* we're done with modifying poll fds */ - usbi_mutex_lock(&ctx->pollfd_modify_lock); - ctx->pollfd_modify--; - usbi_mutex_unlock(&ctx->pollfd_modify_lock); - - /* Release event handling lock and wake up event waiters */ - libusb_unlock_events(ctx); } /** \ingroup dev |