QThread and Queue issue

15 views
Skip to first unread message

Nils

unread,
Aug 8, 2014, 9:07:49 AM8/8/14
to python_in...@googlegroups.com
I'm trying to write something that lets me:
* Create a pool of n threads
* Add m number of tasks (functions to execute)
* Start all threads and process tasks
* Enter an eventloop
* When all tasks are done, exit the eventloop


It works as long as number of tasks (num_tasks) is less than or equal to number number of threads (PARALLEL_PROCESSES) but hangs my program what it is greater, which I fail to understand why. Any ideas?

The reason to why I want to enter an eventloop while waiting for threads to finish as opposed to just joining the threads is because I also want to use a QTimer that checks the progress every x seconds and joining is blocking and wouldn't allow that.

Nils

unread,
Aug 8, 2014, 9:35:21 AM8/8/14
to python_in...@googlegroups.com
Oops, the error was with line 35 where I limited the number of items in queue to equal number of threads. Trying to put in more items will block and wait until an item has been consumed. Removing the limit fixed it.
Reply all
Reply to author
Forward
0 new messages