Zero-allocation adapter around a transfer sequence enabling the use of asynchronous partial I/O operations on a given transfer sequence.
More...
template<detail::TransferSequence TSeq>
struct co_usb::transfer::detail::partial_io_base< TSeq >
Zero-allocation adapter around a transfer sequence enabling the use of asynchronous partial I/O operations on a given transfer sequence.
- Note
- Handles cancellation.
This type is designed to be a barebones wrapper around raw machinery for tying asynchronous transfers into the coroutine ecosystem.
- Transfer sequence lifetime guarantee
Transfer sequence is expected to outlive an instance of this type which uses it. Deallocating, modifying and replacing transfers while an asynchronous operation is pending is undefined behaviour unless it is a cancel_transfer call in which case the operation is well-defined and will cause this particular transfer to be cancelled and cause an error with transfer_status cancelled value.
- Submission order
The submissions are done in a streaming manner, hence the name, where the N transfers from a sequence will be reused for M buffers, in an order in which the transfers complete. This allows to saturate the USB controller ring with large enough set of buffers. In practice, however, the amount of transfers provided has diminishing returns due to internal libusb mutex and ring oversaturation, and after a certain points using more transfers will be slower than using fewer.
- Event handler guarantee
To prevent event handler from prematurely shutting down on stop request an event_handler_ref is held for the entire lifetime of an object of this type.
- See also
- co_usb::ev::event_handler_ref
-
co_usb::ev::detail::handler_service