On 23 August 2012 10:36, Marc Mutz <marc.m...@kdab.com> wrote:
>
> To expand on this:
>
> QTcpSocket is-a QIODevice which is-a QObject, and no QObject can be protected
> by a mutex, since it performs implicit event handling which would be very
> complex to mutex-protect.

A documentation thought: shouldn't we add another category to the
thread-safety capabilities of a class or a function?

Now we have:
1) non-reentrant: safe to be used by only one thread
2) reentrant: safe to be used by multiple threads, provided that
access is serialized ("one at a time")
3) thread-safe: safe to be used by multiple threads, even at the same time

But probably 1 and 2 should be split into something like
1a) safe to be used by a *specific* thread only (GUI classes => only
in the GUI thread)
1b) safe to be used by only one thread (QObjects => use them from the
thread they live in.*)
2) reentrant: as above

-- 
Giuseppe D'Angelo

* Yes, of course, if you manage to control event dispatching then 1b
collapses onto 2, but that's not really how QObjects are meant to be
used, is it?
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to