prevent main loop from being entered with running threads