in reply to Using threads in a for loop

but it is not an elegant way of course. I would like to learn the correct format.

Have you considered a work queue?