Page MenuHomeFreeBSD

libusb: use eventfd
ClosedPublic

Authored by bapt on Thu, May 15, 1:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 29, 5:43 PM
Unknown Object (File)
Wed, May 28, 10:29 AM
Unknown Object (File)
Tue, May 27, 5:16 AM
Unknown Object (File)
Sat, May 24, 11:43 AM
Unknown Object (File)
Sat, May 24, 9:14 AM
Unknown Object (File)
Sat, May 24, 5:06 AM
Unknown Object (File)
Sat, May 24, 1:27 AM
Unknown Object (File)
Fri, May 23, 10:40 PM
Subscribers

Details

Summary

Simplify libusb code by replace pipe(2) inter thread event mecanism
with eventfd(2).

This simplifies the code.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 64198
Build 61082: arc lint + arc unit

Event Timeline

bapt requested review of this revision.Thu, May 15, 1:29 PM

note that it makes android's adb tool working reliably

it does not fix but get stalled less often

It's a good cleanup, even if it doesn't solve the problem.

lib/libusb/libusb10_io.c
190

I wonder if we should be gating this else behind fds[i].revents != 0. It makes sense not to continue at the beginning unconditionally because we need to drop the reference if we had a device, but my concern in this branch is that we could have raced after poll(2) returned and accidentally drained something we shouldn't have.

The question I'm contemplating in particular is: if we were to avoid it here, would we observe a different state above poll(2) when we re-enter this function? e.g., a device appearing. In the worst case scenario, ignoring anything in the pipe here that wasn't at the time of the poll(2) causes a spurious wakeup and we subsequently drain it.

This revision is now accepted and ready to land.Thu, May 15, 2:12 PM
This revision was automatically updated to reflect the committed changes.