summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemwatcher_polling.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QFilesystemWatcher: speed up the unittestsAhmad Samir2024-02-141-1/+11
| | | | | | | | | | | | | | | | | | | The only backend that requires longer wait times is QPollingFileSystemWatcherEngine; lower the interval of the polling engine for the unittests (using the same objectName() trick that is used to force using a specific watcher engine). Remove the comment about FAT32 filesystems, there is no where on the CI where this test fails so far. Before: Totals: 23 passed, 0 failed, 0 skipped, 0 blacklisted, 127027ms After: Totals: 23 passed, 0 failed, 0 skipped, 0 blacklisted, 666ms Change-Id: I96378f810463fa5c4ebdc13946ea23810e80f144 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QPollingFileSystemWatcherEngine: change PollingInterval to chrono::secondsMarc Mutz2023-08-181-0/+7
| | | | | | | | | | | | More expressive and type-safe. Move it to the .cpp file (the only user) and make it static to avoid creating a non-namespaced symbol. Pick-to: 6.6 Change-Id: Ib9b393e660e51c1791ed3a9a4a12e5c75736bf2a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QPollingFileSystemWatcherEngine: replace QTimer with QBasicTimerMarc Mutz2023-08-181-5/+6
| | | | | | | | | | | | | | | We already have a QObject (*this), so we don't need another one in the form of a QTimer; we can just let QTimerEvents be delivered to *this. Changes surprisingly little code, because the code used start(int) already. Mark the timerEvent() final to avoid surprises from potential further-derived classes. Pick-to: 6.6 Change-Id: Ib4ee8f8f6b9995d67d964afb231e913a00a76af3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtCore: replace QLatin1String/QLatin1Char with _L1/u'' where applicableSona Kurazyan2022-03-251-4/+4
| | | | | | | | | | | As a drive-by, did also minor refactorings/improvements. Task-number: QTBUG-98434 Change-Id: I81964176ae2f07ea63674c96f47f9c6aa046854f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
* Don't store iterators on QHash while erasingLars Knoll2020-04-011-11/+14
| | | | | | | | QHash::erase() in the new QHash will invalidate all iterators pointing into the hash. Change-Id: Ia54e8485a947cd7274f832c7c8c624d0aaded4ba Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove the last uses of Java-style iterators in QtCoreMarc Mutz2019-05-231-9/+8
| | | | | | | | | | | | | | | | | | | | They are going to be deprecated. Add a strategic break. This was a pre-existing problem: the comment claims that h is invalid (though I personally don't see it), but then goes on to check the loop condition (which, in the mutable Java iterator case, involves calling h.cend()). We now cache the end iterator, so if there ever was a problem, it's probably a lesser one now, but it's still not kosher, and a debug version of QHash would find it, so break out explicitly. Saves ~200b in text size on optimized GCC 9.1 Linux AMD64 builds, ie. ~100b per loop. Change-Id: I7684485b55fb23a8cf882f89621ebb75a0e607b5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QFileSystemWatcherEngines: port some Java-style iterators to ranged-forMarc Mutz2019-05-211-13/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Java-style iterators are scheduled to be deprecated. The general pattern used in the patch is that instead of copying an input list, then iterating over the copy with some calls to it.remove() (which leads to quadratic-complexity loops), we simply copy conditionally (a la remove_copy_if instead of remove_if). To make clearer what's going on, rename the outgoing list to 'unhandled'. To avoid having to touch too much of the loops' structure, which sometimes is quite convoluted, use qScopeGuard to do the append to 'unhandled', unless the original code removed the element. Saves a surprising almost 5KiB in text size on GCC 9.1 optimized AMD64 Linux builds. Change-Id: Ifd861de9aa48d66b420858606998dd08a8401e03 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Modernize the "filesystemwatcher" featureLiang Qi2018-09-271-4/+0
| | | | | | Change-Id: If030b56ad97e047d89d442629262b4839df306d4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QtCore: include mocsThiago Macieira2017-05-051-0/+3
| | | | | | | | | | | | | | | | | | | Compilation and link times in CPU seconds with GCC 7, using precompiled headers (not including moc, rcc, uic, etc. steps or headersclean): Before After Debug -O0 198,1 180,3 Debug -Og 240,7 229,2 Release -O3 267,1 249,2 Release LTO 239,4 229,8 QtCore required a little manual adjusting because some files are bootstrapped into moc itself and into qmake. Change-Id: I84e363d735b443cb9beefffd14b8b57c10e7da36 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Fix polling file system watcher addPathsBernd Weimer2014-04-161-4/+6
| | | | | | | | | | Fixes QFileSystemWatcher::addPath() auto test when polling file system watcher is in use: adding the same path twice should fail. Change-Id: I2a0df3ffa587fa90fae744858f4471d667443e6f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Fix build error when QT_NO_FILESYSTEMWATCHER is setsh kim2012-03-141-0/+3
| | | | | | | | QPollingFileSystemWatcherEngine inherits from QFileSystemWatcherEngine. This class should be covered by !QT_NO_FILESYSTEMWATCHER. Change-Id: I053a873018cf3c9c443435c9b3f44240b0965c24 Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Make QFileSystemWatcherEngines children of QFileSystemWatcherBradley T. Hughes2012-01-121-2/+3
| | | | | | | | | | To support moving QFileSystemWatcher to another thread, the engines need to follow when the watcher is moved. The easiest way to do this is by parenting the engines to the watcher. Change-Id: Ie2bb701c0c148da9cc2302d4de23286b8ef42c4d Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove unnecessary QMutexes in QFileSystemWatcher implementationsBradley T. Hughes2012-01-121-3/+0
| | | | | | | | | | | | | The polling, inotify, and kqueue implementations are no longer threaded, and as such, do not need mutexes to protect their internal data (since QFileSystemWatcher itself is not documented as a thread-safe API). The Windows implementation is unchanged as it uses multiple threads explicitly. Change-Id: Ia82510397e576bf704ce3aed3d776b58b39f7ff3 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Remove thread from QFileSystemWatcherEngine implementations.Robin Burchell2012-01-101-20/+13
| | | | | | | | | | | | | | | | | | | | | | 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 <joao.abecasis@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Split polling watcher out to its own seperate files.Robin Burchell2012-01-041-0/+160
Just helps maintain sanity and clarity a bit. Change-Id: Iaf00f9ecf2d959afcd8fe18bbca71a403cf9818d Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>