LibUsbDotNet 2.2.8
TryLockEvents Method (sessionHandle)
Library ReferenceMonoLibUsbMonoUsbApiTryLockEvents(MonoUsbSessionHandle)
LibUsbDotNet on SourceForge
Attempt to acquire the event handling lock.
Declaration Syntax
C#Visual BasicVisual C++
public static int TryLockEvents(
	MonoUsbSessionHandle sessionHandle
Public Shared Function TryLockEvents ( _
	sessionHandle As MonoUsbSessionHandle _
) As Integer
static int TryLockEvents(
	[InAttribute] MonoUsbSessionHandle^ sessionHandle
Return Value
  • 0 if the lock was obtained successfully.
  • 1 if the lock was not obtained. (i.e. another thread holds the lock)

This lock is used to ensure that only one thread is monitoring libusb event sources at any one time.

You only need to use this lock if you are developing an application which calls poll() or select() on libusb's file descriptors directly. If you stick to libusb's event handling loop functions (e.g. libusb_handle_events) then you do not need to be concerned with this locking.

While holding this lock, you are trusted to actually be handling events. If you are no longer handling events, you must call libusb_unlock_events as soon as possible.

Note: Member documentation was originally generated using the Libusb-1.0 API documentation: Polling and timing

Assembly: LibUsbDotNet (Module: LibUsbDotNet) Version: (