In this article, it is said that : Some of QObjects are reentrant, making it possible to use these classes from multiple threads simultaneously.
I suppose that a piece of code which is reentrant is also supposed to be thread-safe.
But, the same article continues to say that:
Note that these classes are designed to be created and used from within a single thread; creating an object in one thread and calling its functions from another thread is not guaranteed to work.
Isn't this contradictory? What does it finally mean? Can I safely call QObject functions across threads?
I have copied the relevant portion of the article below:
QObject Reentrancy
QObject is reentrant. Most of its non-GUI subclasses, such as QTimer, QTcpSocket, QUdpSocket, QFtp, and QProcess, are also reentrant, making it possible to use these classes from multiple threads simultaneously. Note that these classes are designed to be created and used from within a single thread; creating an object in one thread and calling its functions from another thread is not guaranteed to work.
a thread-safe function is always reentrant, but a reentrant function is not always thread-safe.- thugaclass is said to be reentrant if its member functions can be called safely from multiple threads, as long as each thread uses a different instance of the class.- thuga