[PySide] most basic QThread problem
Matthew Woehlke
matthew.woehlke at kitware.com
Mon Dec 16 20:48:07 CET 2013
On 2013-12-16 14:32, Frank Rueter | OHUfx wrote:
> will wait() block concurrent threads?
wait() blocks the thread from which it is called until the thread on
which it is called terminates. Generally you should be calling this when
the application is about to exit, or e.g. when you've instructed the
thread to exit and it is not expected to hang around much longer (or has
already exited).
> In my case my app will receive an arbitrary amount of tasks and I need
> to figure out how many of those tasks I want to run at the same time.
That sounds like a job for QThreadPool and/or QtConcurrent. I would try
to avoid actually creating a large number of threads, as they consume
system resources, and instead create a work queue and limit the number
of threads that ever exist concurrently. (QtConcurrent basically does
that for you, automatically. I haven't worked with QThreadPool but I
believe it is similar; in fact I believe it is used to implement
QtConcurrent.)
--
Matthew
More information about the PySide
mailing list