libusb event handler with simple internal reference counting.
More...
#include <handlers.hpp>
|
| auto | start (libusb_context *usb_ctx, std::stop_token stop) -> bool |
| | Start the libusb event processing loop.
|
| |
| auto | ref () noexcept |
| | Increment the internal reference counter.
|
| |
| auto | unref () noexcept |
| | Decrement the internal reference counter.
|
| |
| auto | stop () |
| | Stop the event loop and wait for the thread to finish.
|
| |
| | ~refcounted_event_handler () |
| | Stop the event thread on destruction.
|
| |
libusb event handler with simple internal reference counting.
This implementation runs a background loop calling libusb_handle_events_timeout() until stop is requested and the internal counter reaches zero.
◆ ~refcounted_event_handler()
| co_usb::ev::refcounted_event_handler::~refcounted_event_handler |
( |
| ) |
|
|
inline |
Stop the event thread on destruction.
◆ ref()
| auto co_usb::ev::refcounted_event_handler::ref |
( |
| ) |
|
|
inlinenoexcept |
Increment the internal reference counter.
◆ start()
| auto co_usb::ev::refcounted_event_handler::start |
( |
libusb_context * |
usb_ctx, |
|
|
std::stop_token |
stop |
|
) |
| -> bool
|
|
inline |
Start the libusb event processing loop.
- Parameters
-
| usb_ctx | libusb context to handle events for. |
| stop | Stop token used to end the loop. |
- Returns
- true on successful start.
◆ stop()
| auto co_usb::ev::refcounted_event_handler::stop |
( |
| ) |
|
|
inline |
Stop the event loop and wait for the thread to finish.
Blocks until handling is stopped.
◆ unref()
| auto co_usb::ev::refcounted_event_handler::unref |
( |
| ) |
|
|
inlinenoexcept |
Decrement the internal reference counter.
The documentation for this struct was generated from the following file:
- /home/runner/work/co_usb/co_usb/include/co_usb/ev/handlers.hpp