+ if (pfd[0].fd >= 0) {
+ /* wake up once every second, or whenever the queue file gets gets closed */
+ if (poll(pfd, 1, 1000) > 0 && pfd[0].revents & POLLIN) {
+ char buf[sizeof(struct inotify_event) + PATH_MAX];
+
+ read(pfd[0].fd, buf, sizeof(buf));
+ }
+ } else {
+ nanosleep(&duration, NULL);
+ }