core: Add alternative API for backends to handle transfer completion
Currently all non-Linux POSIX backends emulate the Linux design of
having individual pollable file descriptors for each device. This
patch introduces a new internal API that allows backends to handle
transfer completion notification in a different way.
A new function, usbi_signal_transfer_completion(), is added. Each
backend can call this function when it detects a transfer has
completed. This function will place the transfer on a new
completed_transfers list and will signal the context's event.
Backends that use this new API will no longer provide a handle_events()
function but instead provide a handle_transfer_completion() function.
When a thread is doing event handling, it will call this backend
function for all transfers on the completed_transfers list.
With this change, backends that do not really have natively pollable
file descriptors can completely move away from this design and avoid
poll() altogether.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>