added check to wait for required number of free ring slots