summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qreadwritelock.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2023-04-17 16:49:58 -0700
committerThiago Macieira <thiago.macieira@intel.com>2023-05-11 12:31:56 -0700
commitfcae43237b7501d9da1dc1b838bf4cdb28d3fd91 (patch)
tree1364665e94d292ca945a275d26dc9b67d0feaaca /src/corelib/thread/qreadwritelock.h
parent34914099a1044beba7fdd1b71b079c4130ca0cd4 (diff)
QReadWriteLock: inline the lockForXxx functions
We can now do that because tryLockForXxxx(-1) is fast for the uncontended case too. Change-Id: I3d728c4197df49169066fffd1756ddd06caf7b52 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/thread/qreadwritelock.h')
-rw-r--r--src/corelib/thread/qreadwritelock.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/corelib/thread/qreadwritelock.h b/src/corelib/thread/qreadwritelock.h
index 1a94386386..4db44784e3 100644
--- a/src/corelib/thread/qreadwritelock.h
+++ b/src/corelib/thread/qreadwritelock.h
@@ -21,12 +21,14 @@ public:
explicit QReadWriteLock(RecursionMode recursionMode = NonRecursive);
~QReadWriteLock();
+ QT_CORE_INLINE_SINCE(6, 6)
void lockForRead();
#if QT_CORE_REMOVED_SINCE(6, 6)
bool tryLockForRead();
#endif
bool tryLockForRead(int timeout = 0);
+ QT_CORE_INLINE_SINCE(6, 6)
void lockForWrite();
#if QT_CORE_REMOVED_SINCE(6, 6)
bool tryLockForWrite();
@@ -41,6 +43,18 @@ private:
friend class QReadWriteLockPrivate;
};
+#if QT_CORE_INLINE_IMPL_SINCE(6, 6)
+void QReadWriteLock::lockForRead()
+{
+ tryLockForRead(-1);
+}
+
+void QReadWriteLock::lockForWrite()
+{
+ tryLockForWrite(-1);
+}
+#endif // inline since 6.6
+
#if defined(Q_CC_MSVC)
#pragma warning( push )
#pragma warning( disable : 4312 ) // ignoring the warning from /Wp64