Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
Hi,
I have written a worker thread class in order to run items in parallel. Since my machine have 8 cores of cpu, so I like to ALWAYS run 8-10 thread concurrently. At present, in a while loop, 10 threads are started and stored in a Vector, after that wait for all items (threads) in the vector to join. It's really bad habit!
Is there anyway to know how many worker threads are already running and utilize it to setup a thread-initializer method that guarantees 10 running threads?
Thanks.