From d7ec8bf29ad2f9668c258e9c05012f4a5a0063da Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Thu, 29 Dec 2011 23:56:27 +0100 Subject: Remove thread from QFileSystemWatcherEngine implementations. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These threads are actually counterproductive, as generally speaking, processing watches is not that expensive an operation, so instead, they process at full speed and can (in the case of slow processing in the thread processing the events) stack up and consume resources for no good reason. Threads also have an additional resource consumption per engine (some ~8mb of thread stack on Linux), so doing away with them is nice. A side effect of this change is that events are now effectively rate-limited by the eventloop speed of the thread they run in, so if your thread runs too slow, and you recieve a lot of events, on some platforms, events may be dropped now where in the past, they would be read by the monitor thread and turned into Qt signals (thus not visibly showing as a problem, apart from invisibly bloating memory usage). Task-number: QTBUG-20028 Change-Id: I345a56a8c709f6f778ca9a0b55b57c05229ba477 Reviewed-by: João Abecasis Reviewed-by: Bradley T. Hughes --- src/corelib/io/qfilesystemwatcher_inotify_p.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/corelib/io/qfilesystemwatcher_inotify_p.h') diff --git a/src/corelib/io/qfilesystemwatcher_inotify_p.h b/src/corelib/io/qfilesystemwatcher_inotify_p.h index 7d45711006..24fc88ffeb 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify_p.h +++ b/src/corelib/io/qfilesystemwatcher_inotify_p.h @@ -57,8 +57,9 @@ #ifndef QT_NO_FILESYSTEMWATCHER -#include -#include +#include +#include +#include QT_BEGIN_NAMESPACE @@ -71,13 +72,9 @@ public: static QInotifyFileSystemWatcherEngine *create(); - void run(); - QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories); QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories); - void stop(); - private Q_SLOTS: void readFromInotify(); @@ -87,6 +84,7 @@ private: QMutex mutex; QHash pathToID; QHash idToPath; + QSocketNotifier notifier; }; -- cgit v1.2.3