make sure threads wait for connection before starting main loop