From 3d442b86ae59b07bd0064e3a3ca9fc613545d3f3 Mon Sep 17 00:00:00 2001 From: Tijl Coosemans Date: Fri, 26 Nov 2010 10:11:06 +0100 Subject: QKqueueFileSystemWatcherEngine: Use EV_CLEAR instead of EV_ONESHOT. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using EV_ONESHOT and re-enabling the kevent after emitting the signal allows for a window in which file system changes can go undetected. By using EV_CLEAR instead the kevent can stay enabled. Merge-request: 2425 Reviewed-by: João Abecasis --- src/corelib/io/qfilesystemwatcher_kqueue.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index 378ad20..45aea73 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -157,7 +157,7 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths, EV_SET(&kev, fd, EVFILT_VNODE, - EV_ADD | EV_ENABLE | EV_ONESHOT, + EV_ADD | EV_ENABLE | EV_CLEAR, NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, 0, 0); @@ -315,24 +315,12 @@ void QKqueueFileSystemWatcherEngine::run() else emit fileChanged(path, true); } else { - DEBUG() << path << "changed, re-enabling watch"; + DEBUG() << path << "changed"; if (id < 0) emit directoryChanged(path, false); else emit fileChanged(path, false); - - // renable the watch - EV_SET(&kev, - fd, - EVFILT_VNODE, - EV_ADD | EV_ENABLE | EV_ONESHOT, - NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, - 0, - 0); - if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) { - perror("QKqueueFileSystemWatcherEngine::processKqueueEvents: kevent EV_ADD"); - } } } -- cgit v0.12