[merge] Make console thread safe