summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMate Barany <mate.barany@qt.io>2023-01-11 17:55:16 +0100
committerMate Barany <mate.barany@qt.io>2023-01-19 08:45:01 +0000
commitd4078e9c67d973360026437ad6a8fabc250b7a5e (patch)
tree04fb6fb4cf732570315d997ed27ea20014ad40d1
parentdf78bd62c3125366ce946274c0486090fd241466 (diff)
[doc] Warn users about data races regarding qt_ntfs_permission_lookup
qt_ntfs_permission_lookup is a non-atomic global variable that is prone to data races. Make a remark about this in the documentation. Task-number: QTBUG-105804 Change-Id: If7c64f3ab7d2c3b1487fe56204a4e66c420b0604 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 696ad54e5d76dd063cbb02d0c288fdece6ee75d0) Reviewed-by: Marc Mutz <marc.mutz@qt.io>
-rw-r--r--src/corelib/io/qfiledevice.cpp5
-rw-r--r--src/corelib/io/qfileinfo.cpp5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/io/qfiledevice.cpp b/src/corelib/io/qfiledevice.cpp
index 479fbd1c91..6cf704ae5b 100644
--- a/src/corelib/io/qfiledevice.cpp
+++ b/src/corelib/io/qfiledevice.cpp
@@ -148,6 +148,11 @@ void QFileDevicePrivate::setError(QFileDevice::FileError err, int errNum)
decrementing \c qt_ntfs_permission_lookup by 1.
\snippet ntfsp.cpp 1
+
+ \note Since this is a non-atomic global variable, it is only safe
+ to increment or decrement \c qt_ntfs_permission_lookup before any
+ threads other than the main thread have started or after every thread
+ other than the main thread has ended.
*/
//************* QFileDevice
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 47c9415888..339341a077 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -294,6 +294,11 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request)
\snippet ntfsp.cpp 1
+ \note Since this is a non-atomic global variable, it is only safe
+ to increment or decrement \c qt_ntfs_permission_lookup before any
+ threads other than the main thread have started or after every thread
+ other than the main thread has ended.
+
\section1 Performance Issues
Some of QFileInfo's functions query the file system, but for