[llvm-dev] Can we do atomic write to a file by using raw_fd_ostream?
Jie Zhou via llvm-dev
llvm-dev at lists.llvm.org
Fri Apr 5 17:43:01 PDT 2019
In a pass I’m using raw_fd_ostream to write a string to a file. Does raw_fd_ostream guarantee
the write is atomic when I do parallel compilation (currently I’m using -j8)? I have some errs() to
print information for debugging purposes and I saw that the printed information gets messed up sometime.
If I’m writing a string with the format of “A:B:C”, is it possible that I got “A1:B2:C1” and “A2:B1:C2”
instead of the correct one “A1:B1:C1” and “A2:B2:C2”? And if this is possible, how can I do atomic write to a file?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev