mirror of
https://git.freebsd.org/src.git
synced 2026-01-16 23:02:24 +00:00
libusb: implement libusb_pollfds_handle_timeouts
This function tells applications who maintain the pollfds themselves if they should handle the timeout for each xfer themselves. In FreeBSD, the timeout for each xfer is handled by kernel and doesn't need a special timer to do so. Therefore, we return 1 to indicate that it is handled by libusb internally. Approved by: lwhsu (mentor), markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51742
This commit is contained in:
parent
c43a850451
commit
b0d5c1cfda
3 changed files with 15 additions and 0 deletions
|
|
@ -734,6 +734,14 @@ another thread is already doing so.
|
|||
Must be called with the event lock held.
|
||||
.Pp
|
||||
.Ft int
|
||||
.Fn libusb_pollfds_handle_timeouts "libusb_context *ctx"
|
||||
This function determines whether applications maintaining libusb events using
|
||||
.Fn libusb_get_pollfds
|
||||
are responsible for handling timeout events themselves.
|
||||
Returns 1 if libusb handles the timeout internally, 0 if the application
|
||||
needs to set a dedicated timer to handle it.
|
||||
.Pp
|
||||
.Ft int
|
||||
.Fn libusb_get_next_timeout "libusb_context *ctx" "struct timeval *tv"
|
||||
Determine the next internal timeout that libusb needs to handle.
|
||||
Returns 0
|
||||
|
|
|
|||
|
|
@ -587,6 +587,7 @@ int libusb_handle_events_completed(libusb_context * ctx, int *completed);
|
|||
int libusb_handle_events_timeout(libusb_context * ctx, struct timeval *tv);
|
||||
int libusb_handle_events(libusb_context * ctx);
|
||||
int libusb_handle_events_locked(libusb_context * ctx, struct timeval *tv);
|
||||
int libusb_pollfds_handle_timeouts(libusb_context *ctx);
|
||||
int libusb_get_next_timeout(libusb_context * ctx, struct timeval *tv);
|
||||
void libusb_set_pollfd_notifiers(libusb_context * ctx, libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb, void *user_data);
|
||||
const struct libusb_pollfd **libusb_get_pollfds(libusb_context *ctx);
|
||||
|
|
|
|||
|
|
@ -422,6 +422,12 @@ libusb_get_next_timeout(libusb_context *ctx, struct timeval *tv)
|
|||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
libusb_pollfds_handle_timeouts(libusb_context *ctx)
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
libusb_set_pollfd_notifiers(libusb_context *ctx,
|
||||
libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue