summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemwatcher_polling.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qfilesystemwatcher_polling.cpp')
-rw-r--r--src/corelib/io/qfilesystemwatcher_polling.cpp33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/corelib/io/qfilesystemwatcher_polling.cpp b/src/corelib/io/qfilesystemwatcher_polling.cpp
index 54bdfaf8cb..3d55c6d0aa 100644
--- a/src/corelib/io/qfilesystemwatcher_polling.cpp
+++ b/src/corelib/io/qfilesystemwatcher_polling.cpp
@@ -45,18 +45,9 @@
QT_BEGIN_NAMESPACE
QPollingFileSystemWatcherEngine::QPollingFileSystemWatcherEngine()
+ : timer(this)
{
-#ifndef QT_NO_THREAD
- moveToThread(this);
-#endif
-}
-
-void QPollingFileSystemWatcherEngine::run()
-{
- QTimer timer;
connect(&timer, SIGNAL(timeout()), SLOT(timeout()));
- timer.start(PollingInterval);
- (void) exec();
}
QStringList QPollingFileSystemWatcherEngine::addPaths(const QStringList &paths,
@@ -84,7 +75,13 @@ QStringList QPollingFileSystemWatcherEngine::addPaths(const QStringList &paths,
}
it.remove();
}
- start();
+
+ if ((!this->files.isEmpty() ||
+ !this->directories.isEmpty()) &&
+ !timer.isActive()) {
+ timer.start(PollingInterval);
+ }
+
return p;
}
@@ -105,17 +102,13 @@ QStringList QPollingFileSystemWatcherEngine::removePaths(const QStringList &path
it.remove();
}
}
- if (this->files.isEmpty() && this->directories.isEmpty()) {
- locker.unlock();
- stop();
- wait();
+
+ if (this->files.isEmpty() &&
+ this->directories.isEmpty()) {
+ timer.stop();
}
- return p;
-}
-void QPollingFileSystemWatcherEngine::stop()
-{
- quit();
+ return p;
}
void QPollingFileSystemWatcherEngine::timeout()