void linux_udev_hotplug_poll(void) { struct udev_device* udev_dev; usbi_mutex_static_lock(&linux_hotplug_lock); do { udev_dev = udev_monitor_receive_device(udev_monitor); if (udev_dev) { usbi_dbg("Handling hotplug event from hotplug_poll"); udev_hotplug_event(udev_dev); } } while (udev_dev); usbi_mutex_static_unlock(&linux_hotplug_lock); }
static void *linux_udev_event_thread_main(void *arg) { struct pollfd fds = {.fd = udev_monitor_fd, .events = POLLIN}; usbi_dbg("udev event thread entering."); while (1 == poll(&fds, 1, -1)) { if (NULL == udev_monitor || POLLIN != fds.revents) { break; } udev_hotplug_event(); } usbi_dbg("udev event thread exiting"); return NULL; }
static void *linux_udev_event_thread_main(void *arg) { struct udev_device* udev_dev; struct pollfd fds = {.fd = udev_monitor_fd, .events = POLLIN}; usbi_dbg("udev event thread entering."); while (1 == poll(&fds, 1, -1)) { if (NULL == udev_monitor || POLLIN != fds.revents) { break; } usbi_mutex_static_lock(&linux_hotplug_lock); udev_dev = udev_monitor_receive_device(udev_monitor); if (udev_dev) udev_hotplug_event(udev_dev); usbi_mutex_static_unlock(&linux_hotplug_lock); } usbi_dbg("udev event thread exiting"); return NULL; }