summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2019-05-10 20:47:33 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2019-05-11 10:16:40 +0000
commit41aa78856e054ee0d770e375f127dbc18317fbeb (patch)
treec957419cdcbe9e4089faf2bfb325e0f71ac75e2b /src/corelib/tools
parent341c9106881810962f253c1502d2c4f6da90e149 (diff)
QSharedPointer: fix threadsafety docs
Try and explain better the situation around QSharedPointer: it's reentrant, not thread safe. Change-Id: Ief9d28be8ea3fbaa6014cb6b999626db1bab52ca Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qsharedpointer.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index 95b584e914..b755941b73 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -65,14 +65,19 @@
\section1 Thread-Safety
- QSharedPointer and QWeakPointer are thread-safe and operate
- atomically on the pointer value. Different threads can also access
- the QSharedPointer or QWeakPointer pointing to the same object at
- the same time without need for locking mechanisms.
-
- It should be noted that, while the pointer value can be accessed
- in this manner, QSharedPointer and QWeakPointer provide no
- guarantee about the object being pointed to. Thread-safety and
+ QSharedPointer and QWeakPointer are reentrant classes. This means that, in
+ general, a given QSharedPointer or QWeakPointer object \b{cannot} be
+ accessed by multiple threads at the same time without synchronization.
+
+ Different QSharedPointer and QWeakPointer objects can safely be accessed
+ by multiple threads at the same time. This includes the case where they
+ hold pointers to the same object; the reference counting mechanism
+ is atomic, and no manual synchronization is required.
+
+ It should be noted that, while the pointer value can be accessed in this
+ manner (that is, by multiple threads at the same time, without
+ synchronization), QSharedPointer and QWeakPointer provide no guarantee
+ about the object being pointed to. The specific thread-safety and
reentrancy rules for that object still apply.
\section1 Other Pointer Classes