[Qt-interest] Multithreading - yield function

Thomas Dähling t.daehling at googlemail.com
Tue Sep 1 12:09:15 CEST 2009


2009/9/1 Patric <userqt at gmail.com>:

> you are telling me that if I have two threads that are running, I really
> don't know when the second one will start executing in the middle of the
> code ? And stop also.

This sums it up pretty much, yes. Using threads means your program
flow is now asynchronous, which in turn means that you cannot rely
upon a specific order of thread execution (see
http://en.wikipedia.org/wiki/Scheduling_(computing) for some basic
information). What you can do, however, is provide QWaitConditions or
other locking mechanisms to ensure that one thread will wait for
another, if needed.



More information about the Qt-interest-old mailing list