add flush thread