[Qt-interest] End thread when work is done
Thiago Macieira
thiago at kde.org
Wed Aug 17 21:49:17 CEST 2011
On Wednesday, 17 de August de 2011 19:12:18 Cole, Derek wrote:
> This may be the case, indeed, but I must have some way to kill the active
> threads.
No, you don't.
Andreas is right: QThreadPool manages the lifetime of the threads. It starts
them and exits them when it wants. It will keep them running waiting for more
jobs instead of exiting immediately.
You don't control that.
The documentation for "activeThreadCount" says
This property represents the number of active threads in the thread pool.
which means nothing at all. However, there's elsewhere in the documentation:
The activeThreadCount() function returns the number of threads currently
doing work.
That would imply that the number drops down to 0 if all threads are idling.
Given Derek's experience, I'd guess that the activeThreadCount is the number
of running threads, not the number of working threads, despite the
documentation.
> It doesnt seem like QtConcurrent will let me to create more
> runnables than I have maxThreadCount() - so how would I know how many
> threads I can make? My intent is to max out the number of threads running
> processing a file, when that file is finished, load another and so-on.
Why do you think that it won't let you create more runnables?
--
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/20110817/99eee97b/attachment.bin
More information about the Qt-interest-old
mailing list