LibUsbDotNet 2.2.8
GetNextTimeout Method (sessionHandle, tv)
Library Reference ► MonoLibUsb ► MonoUsbApi ► GetNextTimeout(MonoUsbSessionHandle, UnixNativeTimeval%)
|
C# | Visual Basic | Visual C++ |
public static int GetNextTimeout( MonoUsbSessionHandle sessionHandle, ref UnixNativeTimeval tv )
Public Shared Function GetNextTimeout ( _ sessionHandle As MonoUsbSessionHandle, _ ByRef tv As UnixNativeTimeval _ ) As Integer
public: static int GetNextTimeout( [InAttribute] MonoUsbSessionHandle^ sessionHandle, UnixNativeTimeval% tv )
- sessionHandle (MonoUsbSessionHandle)
- A valid MonoUsbSessionHandle.
- tv (UnixNativeTimeval%)
- The maximum time to block waiting for events, or zero for non-blocking mode
You only need to use this function if you are calling poll() or select() or similar on libusb's file descriptors yourself - you do not need to use it if you are calling libusb_handle_events or a variant directly.
You should call this function in your main loop in order to determine how long to wait for select() or poll() to return results. libusb needs to be called into at this timeout, so you should use it as an upper bound on your select() or poll() call.
When the timeout has expired, call into libusb_handle_events_timeout (perhaps in non-blocking mode) so that libusb can handle the timeout.
This function may return 1 (success) and an all-zero timeval. If this is the case, it indicates that libusb has a timeout that has already expired so you should call libusb_handle_events_timeout or similar immediately. A return code of 0 indicates that there are no pending timeouts.
On some platforms, this function will always returns 0 (no pending timeouts). See Notes on time-based events.