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.

Den fredagen den 8:e augusti 2014 kl. 15:07:49 UTC+2 skrev Nils:
>
> 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
>
> This is what I came up with 
> https://gist.github.com/pyshling/92fa607a8c00b38fb6ab#file-gistfile1-py
>
> 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/7a09f2a2-2e40-42b8-8f75-411acf4fa6b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to