My understanding is that thread.join will suspend the execution of code on the calling thread until the spawned thread finishes or is aborted...
With that in mind, I tried this:
However, the rest of the code runs when the loop finishes, not waiting for all the spawned threads to finish.Code:For i = 1 to 50 threads = New Thread(AddressOf test) threads.IsBackground = True threads.SetApartmentState(ApartmentState.STA) threads.Start(i) next threads.join ''''rest of code after''''
Since the rest of the code needs the threads to finish (otherwise the rest will error), is there any way to accomplish this?




Reply With Quote