From b484f841a55e7645ff2e20cfd3b8f36be4e2a4a0 Mon Sep 17 00:00:00 2001 From: Chris Dickens Date: Tue, 18 Aug 2020 12:58:57 -0700 Subject: [PATCH] Documentation: Add a note regarding the execution context of callbacks Make it more clear that callbacks are only called when libusb_handle_events() is called and that all callbacks will be called on the same thread calling that function. Closes #349 Signed-off-by: Chris Dickens --- libusb/io.c | 9 ++++++++- libusb/version_nano.h | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libusb/io.c b/libusb/io.c index 3b1a513..b95c382 100644 --- a/libusb/io.c +++ b/libusb/io.c @@ -544,7 +544,14 @@ if (r == 0 && actual_length == sizeof(data)) { * application must call into when libusb has work do to. This gives libusb * the opportunity to reap pending transfers, invoke callbacks, etc. * - * There are 2 different approaches to dealing with libusb_handle_events: + * \note + * All event handling is performed by whichever thread calls the + * libusb_handle_events() function. libusb does not invoke any callbacks + * outside of this context. Consequently, any callbacks will be run on the + * thread that calls the libusb_handle_events() function. + * + * When to call the libusb_handle_events() function depends on which model + * your application decides to use. The 2 different approaches: * * -# Repeatedly call libusb_handle_events() in blocking mode from a dedicated * thread. diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 7636904..0782b51 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11542 +#define LIBUSB_NANO 11543 -- 2.7.4