usbi_handle_transfer_completion: Remove signal to event waiters
authorChris Dickens <christopher.a.dickens@gmail.com>
Tue, 26 Aug 2014 06:26:51 +0000 (23:26 -0700)
committerChris Dickens <christopher.a.dickens@gmail.com>
Wed, 27 Aug 2014 08:49:03 +0000 (01:49 -0700)
usbi_handle_transfer_completion() is only called by backends when
handling transfer completion. The backend can only make this call
whilst holding the events lock, therefore it is pointless to send
this signal. Any threads waiting to be signaled will be woken up
and will either find that an event handler is still active or will
try to obtain the events lock and be blocked.

Event waiters are automatically signaled in libusb_unlock_events(),
so when the backend is done handling events it will release the lock
and wake up any waiters. At this point the events lock wll be free,
which is the only time waking up waiters makes sense.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
libusb/io.c

index b9ca767..8377a5e 100644 (file)
@@ -1599,9 +1599,6 @@ int usbi_handle_transfer_completion(struct usbi_transfer *itransfer,
         * this point. */
        if (flags & LIBUSB_TRANSFER_FREE_TRANSFER)
                libusb_free_transfer(transfer);
-       usbi_mutex_lock(&ctx->event_waiters_lock);
-       usbi_cond_broadcast(&ctx->event_waiters_cond);
-       usbi_mutex_unlock(&ctx->event_waiters_lock);
        libusb_unref_device(handle->dev);
        return 0;
 }