lock stdout/-err to ensure that the buffers stay flushed until after fork() from all threads