| USBD_REF_WAIT(9) | Kernel Developer's Manual | USBD_REF_WAIT(9) |
usbd_ref_incr,
usbd_ref_decr, usbd_ref_wait
— wait for all USB device references to
complete
#include
<dev/usb/usb.h>
#include <dev/usb/usbdi.h>
void
usbd_ref_incr(struct
usbd_device *dev);
void
usbd_ref_decr(struct
usbd_device *dev);
void
usbd_ref_wait(struct
usbd_device *dev);
The
usbd_ref_wait()
function is used on a device level to tsleep(9) until the
reference counter has reached zero.
To increase the reference counter use
usbd_ref_incr().
To decrease the reference counter use
usbd_ref_decr().
Once the reference counter has been decreased to zero,
usbd_ref_decr() will call
wakeup()
to interrupt the
tsleep()
at the point where usbd_ref_wait() was previously
set.
Typical use cases to wait for tasks to complete is at device closing or detachment.
usbd_ref_incr(),
usbd_ref_decr(), and
usbd_ref_wait() can be called during autoconf or
from process context.
| June 30, 2016 | Debian |