summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemwatcher_fsevents_p.h
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2014-02-26 15:32:01 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-27 17:51:21 +0100
commitdd453adbe7611900ff20ee77141229c01fe1bc98 (patch)
tree92665155cb918068ed110574328d700051920984 /src/corelib/io/qfilesystemwatcher_fsevents_p.h
parentff3dcc49c4a1912189091e35e87cb61af2f62d47 (diff)
Mac: make FSEvents-based QFileSystemWatcherEngine more robust.
- Record the last event ID with every callback. This event ID is passed to FSEventStreamCreate when restarting the stream, so the watcher will receive all events that occurred since invalidating the previous stream. - Never start with kFSEventStreamEventIdSinceNow, because this will generate a (bogus) soft-assert in FSEventStreamFlushSync in CarbonCore when no event occurred since stream creation. The last globally generated event ID is used instead to simulate the "now". - Do not dispose and recreate the stream in the callback, but use a queued signal-slot connection to schedule this on thread that owns the watcher. Change-Id: I02f5a845d9e27f9853ed97925ab9c7a5bc0dede1 Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/corelib/io/qfilesystemwatcher_fsevents_p.h')
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents_p.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents_p.h b/src/corelib/io/qfilesystemwatcher_fsevents_p.h
index c899c556c8..2de2bf4f18 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents_p.h
+++ b/src/corelib/io/qfilesystemwatcher_fsevents_p.h
@@ -84,10 +84,12 @@ public:
Q_SIGNALS:
void emitFileChanged(const QString path, bool removed);
void emitDirectoryChanged(const QString path, bool removed);
+ void scheduleStreamRestart();
private slots:
void doEmitFileChanged(const QString path, bool removed);
void doEmitDirectoryChanged(const QString path, bool removed);
+ void restartStream();
private:
struct Info {
@@ -122,11 +124,11 @@ private:
bool startStream();
void stopStream(bool isStopped = false);
InfoByName scanForDirEntries(const QString &path);
- void derefPath(const QString &watchedPath);
- void checkDir(DirsByName::iterator &it);
- void rescanDirs(const QString &path);
- void rescanFiles(InfoByName &filesInPath);
- void rescanFiles(const QString &path);
+ bool derefPath(const QString &watchedPath);
+ bool checkDir(DirsByName::iterator &it);
+ bool rescanDirs(const QString &path);
+ bool rescanFiles(InfoByName &filesInPath);
+ bool rescanFiles(const QString &path);
QMutex lock;
dispatch_queue_t queue;
@@ -134,6 +136,7 @@ private:
FilesByPath watchedFiles;
DirsByName watchedDirectories;
PathRefCounts watchedPaths;
+ FSEventStreamEventId lastReceivedEvent;
};
QT_END_NAMESPACE