diff options
author | Norwegian Rock Cat <qt-info@nokia.com> | 2009-07-09 09:51:13 (GMT) |
---|---|---|
committer | Norwegian Rock Cat <qt-info@nokia.com> | 2009-07-23 15:17:02 (GMT) |
commit | 098be4ffcf4c9ba615332f853fd440ea630a4453 (patch) | |
tree | e459998a0388289136820c5cc3a2564f01a368d8 /src/corelib/io/qfilesystemwatcher.cpp | |
parent | f439550632c0552514f73d2778c7920811e225f7 (diff) | |
download | Qt-098be4ffcf4c9ba615332f853fd440ea630a4453.zip Qt-098be4ffcf4c9ba615332f853fd440ea630a4453.tar.gz Qt-098be4ffcf4c9ba615332f853fd440ea630a4453.tar.bz2 |
Implement an FSEvents-based QFileSystemWatcherEngine
This has been around for a while and really should have been put in
earlier. Mac OS X (client) has a much lower ulimit for open files than
what some other Unix-like OS's have (in defense it does save memory).
However, if you start watching a lot of files, it will start to fall
down. You can adjust the ulimit, but it's a bit inconvenient. FSEvents
watches the directory and notifies you of changes that happen in that
directory (and below, but we don't really use it). It also can be
adjusted for latency so that performance isn't affected by heavy file
system use (but Qt doesn't use that either at the moment). The other
thing is that it doesn't require any open files, so it's much better for
our number of open files. This feature is only on Leopard and up, so
people wanting to deploy Tiger will still have the "open files" problem
to deal with.
There are still some optimizations available in this code. For example,
we could coalesce things down to watch only one high-level directory
without changing much of the implementation. The current implementation
has some very simplistic ways of handling things, but this simplicity
works well. I documented it, so you can see that, yes, I really
meant to do that.
Task-Id: 164068 (and others)
Reviewed-by: Denis
Diffstat (limited to 'src/corelib/io/qfilesystemwatcher.cpp')
-rw-r--r-- | src/corelib/io/qfilesystemwatcher.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp index b321644..902e240 100644 --- a/src/corelib/io/qfilesystemwatcher.cpp +++ b/src/corelib/io/qfilesystemwatcher.cpp @@ -58,6 +58,9 @@ # include "qfilesystemwatcher_inotify_p.h" # include "qfilesystemwatcher_dnotify_p.h" #elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC) +# if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) +# include "qfilesystemwatcher_fsevents_p.h" +# endif //MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) # include "qfilesystemwatcher_kqueue_p.h" #endif @@ -243,7 +246,12 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine() eng = QDnotifyFileSystemWatcherEngine::create(); return eng; #elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC) - return QKqueueFileSystemWatcherEngine::create(); +# if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) + return QFSEventsFileSystemWatcherEngine::create(); + else +# endif + return QKqueueFileSystemWatcherEngine::create(); #else return 0; #endif |