[PATCH] D27295: Remove existing file in a separate thread asynchronously.

Bob Haarman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 1 17:16:10 PST 2016


inglorion added a comment.

I like the idea of writing to a temporary file, then renaming that. That way, we keep the original file in place until we have a complete file to replace it with, and the replace operation should be fast and atomic on most reasonable filesystems.

Having said that, there are a few potential downsides to this approach. For one, it requires disk space to be sufficient to hold both the old and the new file. For another, some scripts or tools may depend on the output file being absent if the link did not succeed.

If we do end up implementing this "rename, then remove in a separate thread", I would suggest moving it into LLVM. It is a technique I've often found useful, particularly when deleting directories.


https://reviews.llvm.org/D27295





More information about the llvm-commits mailing list