I wish to spin up X threads which will fire X requests to the specified server within the code. Currently, my application is waiting for each thread and X requests to finish
Your culprit is this line:
handle.join().unwrap();
You execute a thread in the loop, and then right after starting the thread you join
it into the main thread.
What you could do, is to create a Vec
and put all the handles in the vec. Then, in another loop, you join
all the handles.
Another possibility is to simply not join the threads, and let them exit naturally, but then you won't know when all of them are done. Which, as @delnan notes, might allow the main thread to exit before the spawned threads exit. This causes all the spawned threads to be killed instead of letting them run to termination.