Marc replied about functions, but let's talk about classes and objects. That is, let's talk about calling different member functions of a particular class.
On quinta-feira, 23 de agosto de 2012 12.00.43, Giuseppe D'Angelo wrote: > 1) non-reentrant: safe to be used by only one thread Non-reentrant means this function or class can only be called from one thread at a time, regardless of which object it's operating on. An even stricter requirement is that of GUI classes: not only are they non- reentrant, the only thread where they can be called is the GUI thread. > 2) reentrant: safe to be used by multiple threads, provided that > access is serialized ("one at a time") That's not what it means. It means that it's safe to call these member functions from different threads, provided they operate on separate objects. > 3) thread-safe: safe to be used by multiple threads, even at the same time Correct: these functions in this particular class can be called on simultaneously from multiple threads, even on the same object, provided that's all you're doing to this object. By definition, all thread-safe functions are reentrant. There are certain classes in Qt that are hybrid between reentrant and thread- safe: the implicitly-shared container classes. By construction, the const functions are thread-safe and the non-const ones are only reentrant. But note the "provided that's all you're doing to this object" part: if you're calling a non-thread-safe reentrant functions on that object, you can't use the thread-safe functions at the same time. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center Intel Sweden AB - Registration Number: 556189-6027 Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest