diff options
author | Tijl Coosemans <tijl@coosemans.org> | 2010-11-26 09:11:06 (GMT) |
---|---|---|
committer | João Abecasis <joao.abecasis@nokia.com> | 2010-11-26 16:07:25 (GMT) |
commit | 3d442b86ae59b07bd0064e3a3ca9fc613545d3f3 (patch) | |
tree | 3fde385b61b73364a1debbda6248dbad006d4168 | |
parent | 1dffae94302099f1e6d1eb5835e46239f7b8f2a5 (diff) | |
download | Qt-3d442b86ae59b07bd0064e3a3ca9fc613545d3f3.zip Qt-3d442b86ae59b07bd0064e3a3ca9fc613545d3f3.tar.gz Qt-3d442b86ae59b07bd0064e3a3ca9fc613545d3f3.tar.bz2 |
QKqueueFileSystemWatcherEngine: Use EV_CLEAR instead of EV_ONESHOT.
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 <joao.abecasis@nokia.com>
-rw-r--r-- | src/corelib/io/qfilesystemwatcher_kqueue.cpp | 16 |
1 files 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"); - } } } |