[Qt-interest] QThreads not running in parallel
Thiago Macieira
thiago at kde.org
Mon Oct 10 21:55:15 CEST 2011
On Monday, 10 de October de 2011 20:20:43 Jothy wrote:
> Hi all,
>
> I am running several (8) QThreads in the following sequence, but it doesn't
> seem to run in parallel. Only 3/4 are executed at once.
>
> thread1->start(Qt::HighestPriority);
> thread1->wait();
> .
> .
> .
> .
> .
> .
> .
> thread8->start(Qt::HighestPriority);
> thread8->wait();
>
>
> What's the problem?
The design of your code.
You designed it to *wait* for the thread to exit before starting the next. So
it will run at most two at a time: the main thread and the one you started.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111010/c5c680b4/attachment.bin
More information about the Qt-interest-old
mailing list