
On Sat, Aug 2, 2008 at 1:48 PM, Ion GaztaƱaga
Ion GaztaƱaga wrote:
The same problem with files and I haven't seen any clue to make Unix and Windows behavior identical until today:
http://mg.to/2004/09/30/file_share_delete-in-shell-extension
According to this, adding FILE_SHARE_DELETE to the shared memory emulation functions would allow, UNIX-like behavior for Windows files. I haven't had time to test this.
I've just checked this, but it does not behave like unix. If you specify FILE_SHARE_DELETE you DeleteFile returns success when the file when it's in use (but the file it's still there in the explorer) and opening the file after deletion fails. However, if you try to create another file with the same name this also fails. So you can't just call "remove" and recreate the file with the same name. That's a pity.
If you are at making behavior identical, I would much prefer the windows way rather than posix way. Not a preference towards any platform, just that the windows way seems to make more sense. Or maybe two 'removes', one which works as it does now and other the smart_remove. In case someone out there does prefer's posix way. Of course, I don't have any answer as to how to get either done. I have been trying to hack in Bob's solution in my code as it can work atleast for me. But its painful as internal implementation of named_semaphore is different on win/lin/mac, so both lin and mac will need separate hacks, and then this is something that will need to be carefully examined again every time boost is updated as internal implementations may change is future. Sometimes I just wish things were easier :-) Sachin Garg