Avoid 100% CPU useage at EOF.