support exit_when_queue_empty