The Qt documentation states this about thread-safety and reentrancy:
Note: Qt classes are only documented as thread-safe if they are intended to be used by multiple threads. If a function is not marked as thread-safe or reentrant, it should not be used from different threads. If a class is not marked as thread-safe or reentrant then a specific instance of that class should not be accessed from different threads.
This seems to state that every function and class in Qt should be considered non-reentrant and non-thread-safe unless explicitly stated so.
However, in the documentation of QRect
and QPoint
, for example, neither thread-safety nor reentrancy is mentioned, but I find it hard to believe they are not. In fact, this old discussion says its a "lack" in the documentation:
These classes are just plain data (a few primitives), no shared structured or static data, so they are reentrant. That they are not marked as such, is a lack in our documentation.
So, how should we know if a function is reentrant or not? Is the reentrancy note omitted only for simple classes where it's implied by its obviousness?
QPointer
seems to be one. – Clemmy