From 9e8dcaa1e3a0da1c3d4ba9f3e628e2eb1d15fe8a Mon Sep 17 00:00:00 2001 From: Mate Barany Date: Wed, 11 Jan 2023 17:55:16 +0100 Subject: [PATCH] [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 Reviewed-by: Edward Welbourne (cherry picked from commit 696ad54e5d76dd063cbb02d0c288fdece6ee75d0) --- src/corelib/io/qfiledevice.cpp | 5 +++++ src/corelib/io/qfileinfo.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/corelib/io/qfiledevice.cpp b/src/corelib/io/qfiledevice.cpp index 4e508e65972..90b67a22e39 100644 --- a/src/corelib/io/qfiledevice.cpp +++ b/src/corelib/io/qfiledevice.cpp @@ -109,6 +109,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 351fbc3d861..17f717c3437 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -265,6 +265,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