this can go in the top-level block i think; no need to drop/retake the mutex on each iteration since the cond.Wait does that