Thread safe Server with exit