chromeos_smart_card_connector icon indicating copy to clipboard operation
chromeos_smart_card_connector copied to clipboard

[libusb] Improve transfer results ordering

Open emaxx-google opened this issue 2 years ago • 0 comments

Our current libusb implementation doesn't guarantee any particular ordering in case there are multiple transfers simultaneously in flight. This might or might not be a problem, depending on the needs of the consumer application.

There are several reasons that cause undetermined ordering:

  1. The transfer results from the JS API are temporarily put into a map that's ordered by some key (which is not a time nor a counter, but some other data).
  2. Pending transfers are stored in a set-inside-map, so they're not ordered either.
  3. [already fixed] Until recently, synchronous transfers had special implementation, such that synchronous transfers were fighting with asynchronous event loops (and who wins was determined, basically, on the order in which the POSIX conditional variable notified callers).

emaxx-google avatar Nov 25 '21 16:11 emaxx-google