synchronize output from threads on line level