This can be use to synchronize writes between threads, assuming writes all go through this and not stdout.