Under Linux, my program would do something like this:
- Process 1 opens a file (e.g. by mapping it into memory). Let's call this file#1
- Process 2 unlinks the file, and creates a new file with the same name. Let's call this file#2.
- Process 1 continues to work with file#1. When it is closed, it is deleted (since it has no links).
- When both processes have exited, file#2 remains on disk.
I want to achieve the same semantics in Windows. After reading this question, I think FILE_SHARE_DELETE does basically this. Is opening the file with FILE_SHARE_DELETE enough, or do I need to consider something more?
The above execution flow is just an example, I know there are other ways of solving that exact problem in Windows, but I want to understand how to make such code portable between Windows and Linux.
Aucun commentaire:
Enregistrer un commentaire