Open patstew opened 5 months ago
To be clear, you're suggesting that instead of renaming the file with an open map, you just keep adding hard links until when you eventually tear down the map and close the file, all the links now marked delete on close will get cleaned up?
Yes, basically. Though I was only thinking about doing it once. I haven't thought through all the implications, In my case I create a temporary file which the user can choose to save later on, and with this workaround I can avoid waiting for all my threads to stop looking at the map so I can relink it, or having to copy it, for the sake of windows.
Currently the docs for mapped_file_handle say:
which is true, but what you can do is link+unlink it which has almost the same effect, except you can't reuse the old filename until you release the handle. Might be a useful fallback for mapped_file_handle::relink and/or relink_or_clone_copy_unlink? It's useful, at least to me, to be able to rename a mapped file without changing address or having to copy the whole thing.