conditional sleep after thread yield