I have a task I need to perform, do_stuff(opts)
, that will take ~1s each, even while 1 - 10 of them are running in parallel. I need to collect an array of the results for each operation at the end.
If I have 30 stuffs to do, how would I use threading effectively to queue up the do_stuff(opts)
operations so no more than 10 are running concurrently, but the array of results is not given/printed/etc until all (30) tasks have been completed?
I usually have at least some code to try and illustrate what I mean, but with threading I'm at a bit of a loss! Thanks in advance