Thankyou both Don Stewart and Simon Marlow for your responses.
By adding yield and threadDelay in certain spots I have at least prevented
some of the threads from being starved of CPU time.
The only issue now is that terminateProcess doesn't always terminate
netstat.exe in the cmd.exe so I don't get an exit condition.