[PATCH imagefactory 14/32] Clean up the waiting loops.