diff options
| author | Kai Köhne <kai.koehne@qt.io> | 2025-07-04 17:05:36 +0200 |
|---|---|---|
| committer | Kai Köhne <kai.koehne@qt.io> | 2025-07-07 20:54:03 +0200 |
| commit | c59adf5a3a4950e2fed5e60e3b3d316281c9f918 (patch) | |
| tree | 73029651cb3f350beb300a4f4b5df4c3e61a0138 /src/corelib/thread/qmutex.cpp | |
| parent | 11f2d3c86f41f0f05de0a74cf16166c4487a72a2 (diff) | |
Doc: Remove deadlock warnings in most QMutex documentation
The origin of this sentence predates the Qt 5 history. Anyhow, as is,
the sentence is too general, as locking the same mutex
over time from the same thread is definitely supported, as long as
it is also unlocked every time. Furthermore, for the tryLock()
variants, the thread will only dead-lock if an infinite wait time
is specified.
Improve the sentence for QMutex::lock(), but just leave out this
information for the other methods. The behavior is arguably as you
would expect it from a mutex.
Pick-to: 6.9 6.10
Change-Id: I0b658cc29c2f2d2cd6b59d49e2baa285508ec720
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread/qmutex.cpp')
| -rw-r--r-- | src/corelib/thread/qmutex.cpp | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index bd3b269c0b7..832d87332b0 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -120,8 +120,8 @@ void QBasicMutex::destroyInternal(void *ptr) Locks the mutex. If another thread has locked the mutex then this call will block until that thread has unlocked it. - Calling this function multiple times on the same mutex from the - same thread will cause a \e dead-lock. + If the mutex was already locked by the current thread, this call will + never return, causing a \e dead-lock. \sa unlock() */ @@ -140,9 +140,6 @@ void QBasicMutex::destroyInternal(void *ptr) If the lock was obtained, the mutex must be unlocked with unlock() before another thread can successfully lock it. - Calling this function multiple times on the same mutex from the - same thread will cause a \e dead-lock. - \sa lock(), unlock() */ @@ -157,9 +154,6 @@ void QBasicMutex::destroyInternal(void *ptr) If the lock was obtained, the mutex must be unlocked with unlock() before another thread can successfully lock it. - Calling this function multiple times on the same mutex from the - same thread will cause a \e dead-lock. - \sa lock(), unlock() */ @@ -172,9 +166,6 @@ void QBasicMutex::destroyInternal(void *ptr) If the lock was obtained, the mutex must be unlocked with unlock() before another thread can successfully lock it. - Calling this function multiple times on the same mutex from the - same thread will cause a \e dead-lock. - \sa lock(), unlock() */ @@ -202,9 +193,6 @@ void QBasicMutex::destroyInternal(void *ptr) If the lock was obtained, the mutex must be unlocked with unlock() before another thread can successfully lock it. - Calling this function multiple times on the same mutex from the - same thread will cause a \e dead-lock. - \sa lock(), unlock() */ @@ -222,9 +210,6 @@ void QBasicMutex::destroyInternal(void *ptr) If the lock was obtained, the mutex must be unlocked with unlock() before another thread can successfully lock it. - Calling this function multiple times on the same mutex from the - same thread will cause a \e dead-lock. - \sa lock(), unlock() */ |
