linux-v4l2: Check udev fd events

udev_event_thread calls poll with two fds: the udev fd, and an eventfd
used for shutdown.  On FreeBSD we were hanging on shutdown in
udev_monitor_receive_device after receiving the eventfd event.

Now, if the udev fd reports no events skip the
udev_monitor_receive_device call.

At shutdown the loop will exit via os_event_try().
master
Ed Maste 2022-08-16 21:30:02 -04:00 committed by Jim
parent 87b5f17b2f
commit 91f986ec99
1 changed files with 4 additions and 0 deletions

View File

@ -133,12 +133,16 @@ static void *udev_event_thread(void *vptr)
fds[0].fd = fd;
fds[0].events = POLLIN;
fds[0].revents = 0;
fds[1].fd = udev_event_fd;
fds[1].events = POLLIN;
if (poll(fds, 2, 1000) <= 0)
continue;
if (!fds[0].revents & POLLIN)
continue;
dev = udev_monitor_receive_device(mon);
if (!dev)
continue;