From b484f841a55e7645ff2e20cfd3b8f36be4e2a4a0 Mon Sep 17 00:00:00 2001 From: Chris Dickens Date: Tue, 18 Aug 2020 12:58:57 -0700 Subject: 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 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libusb/io.c') 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. -- cgit v1.2.1