Make flush_to_ldisc properly handle parallel calls