|
co_usb
|
Low-level awaitable primitive for strapping hotplug callbacks to a coroutine ecosystem. More...
#include <hotplug_awaitable.hpp>
Public Member Functions | |
| hotplug_awaitable (libusb_context *ctx, int events, int flags, int vid, int pid, int dev_class) | |
| bool | await_ready () noexcept |
| std::coroutine_handle | await_suspend (std::coroutine_handle<> h, boost::capy::io_env const *env) |
| suspends and registers the callback | |
| boost::capy::io_result< hotplug_event, device_ref > | await_resume () |
Low-level awaitable primitive for strapping hotplug callbacks to a coroutine ecosystem.
This is the lowest possible layer of abstraction over libusb's hotplug API. It should be used for maximum flexibility or when the behaviour of device_acceptor is unacceptable, e.g. when no heap allocation is acceptable.
Objects of this type are copyable since an awaitable object itself does not own any resource and operates on handles, pointers and integers instead. It it safe to copy and to move in any state.
| co_usb::hotplug_awaitable::hotplug_awaitable | ( | libusb_context * | ctx, |
| int | events, | ||
| int | flags, | ||
| int | vid, | ||
| int | pid, | ||
| int | dev_class | ||
| ) |
|
noexcept |
| boost::capy::io_result< co_usb::hotplug_event, co_usb::device_ref > co_usb::hotplug_awaitable::await_resume | ( | ) |
| std::coroutine_handle co_usb::hotplug_awaitable::await_suspend | ( | std::coroutine_handle<> | h, |
| boost::capy::io_env const * | env | ||
| ) |
suspends and registers the callback
| h | std::coroutine_handle to the awaiting coroutine |
| env | boost::capy::io_env* as per boost::capy::IoAwaitable concept |
h on submission error or on cancellation