diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp index cd1c8691bf..b7c5ae8453 100644 --- a/src/corelib/compat/removed_api.cpp +++ b/src/corelib/compat/removed_api.cpp @@ -525,6 +525,17 @@ qsizetype QString::toUcs4_helper(const ushort *uc, qsizetype length, uint *out) } #if QT_CONFIG(thread) +#include "qreadwritelock.h" + +bool QReadWriteLock::tryLockForRead() +{ + return tryLockForRead(0); +} + +bool QReadWriteLock::tryLockForWrite() +{ + return tryLockForWrite(0); +} #include "qthreadpool.h" #include "private/qthreadpool_p.h" diff --git a/src/corelib/thread/qreadwritelock.cpp b/src/corelib/thread/qreadwritelock.cpp index fd60fb0934..7e29aa3905 100644 --- a/src/corelib/thread/qreadwritelock.cpp +++ b/src/corelib/thread/qreadwritelock.cpp @@ -146,27 +146,6 @@ void QReadWriteLock::lockForRead() } /*! - Attempts to lock for reading. If the lock was obtained, this - function returns \c true, otherwise it returns \c false instead of - waiting for the lock to become available, i.e. it does not block. - - The lock attempt will fail if another thread has locked for - writing. - - If the lock was obtained, the lock must be unlocked with unlock() - before another thread can successfully lock it for writing. - - It is not possible to lock for read if the thread already has - locked for write. - - \sa unlock(), lockForRead() -*/ -bool QReadWriteLock::tryLockForRead() -{ - return tryLockForRead(0); -} - -/*! \overload Attempts to lock for reading. This function returns \c true if the lock was obtained; otherwise it returns \c false. If another thread @@ -266,27 +245,6 @@ void QReadWriteLock::lockForWrite() } /*! - Attempts to lock for writing. If the lock was obtained, this - function returns \c true; otherwise, it returns \c false immediately. - - The lock attempt will fail if another thread has locked for - reading or writing. - - If the lock was obtained, the lock must be unlocked with unlock() - before another thread can successfully lock it. - - It is not possible to lock for write if the thread already has - locked for read. - - \sa unlock(), lockForWrite() -*/ -bool QReadWriteLock::tryLockForWrite() -{ - return tryLockForWrite(0); -} - -/*! \overload - Attempts to lock for writing. This function returns \c true if the lock was obtained; otherwise it returns \c false. If another thread has locked for reading or writing, this function will wait for at diff --git a/src/corelib/thread/qreadwritelock.h b/src/corelib/thread/qreadwritelock.h index 675b247642..1a94386386 100644 --- a/src/corelib/thread/qreadwritelock.h +++ b/src/corelib/thread/qreadwritelock.h @@ -22,12 +22,16 @@ public: ~QReadWriteLock(); void lockForRead(); +#if QT_CORE_REMOVED_SINCE(6, 6) bool tryLockForRead(); - bool tryLockForRead(int timeout); +#endif + bool tryLockForRead(int timeout = 0); void lockForWrite(); +#if QT_CORE_REMOVED_SINCE(6, 6) bool tryLockForWrite(); - bool tryLockForWrite(int timeout); +#endif + bool tryLockForWrite(int timeout = 0); void unlock();