Wait for another thread to signal completion of an event.
Declaration Syntax
C# | Visual Basic | Visual C++ |
public static int WaitForEvent( MonoUsbSessionHandle sessionHandle, ref UnixNativeTimeval timeval )
Public Shared Function WaitForEvent ( _ sessionHandle As MonoUsbSessionHandle, _ ByRef timeval As UnixNativeTimeval _ ) As Integer
public: static int WaitForEvent( [InAttribute] MonoUsbSessionHandle^ sessionHandle, UnixNativeTimeval% timeval )
Parameters
- sessionHandle (MonoUsbSessionHandle)
- A valid MonoUsbSessionHandle.
- timeval (UnixNativeTimeval%)
- Maximum timeout for this blocking function.
Return Value
- 0 after a transfer completes or another thread stops event handling.
- 1 if the timeout expired.
Remarks
This function will block until any of the following conditions are met: The timeout expires.A transfer completes.A thread releases the event handling lock through libusb_unlock_events.
Condition 1 is obvious. Condition 2 unblocks your thread after the callback for the transfer has completed. Condition 3 is important because it means that the thread that was previously handling events is no longer doing so, so if any events are to complete, another thread needs to step up and start event handling.
This function releases the event waiters lock before putting your thread to sleep, and reacquires the lock as it is being woken up.
Note:
Member documentation was originally generated using the Libusb-1.0 API documentation:
Polling and timing