while( !quitting )
{
int ret;
struct timespec timeout = {1, 0};
struct kevent ke;
if ( kevent(global_kqueue_handle, NULL, 0, &ke, 1, NULL) == -1 )
if ((ret = kevent(global_kqueue_handle, NULL, 0, &ke, 1, &timeout)) <= 0 )
DPRINTF(E_WARN, L_INOTIFY, "kevent polling failure: %s\n", strerror(errno));
if (ret == -1)
continue;
}