Re: How to wait for file closing?
- Posted by mattlewis (admin) Dec 12, 2012
- 1525 views
DerekParnell said...
I just did a quick test and it appears that lock_file() is not working on Windows platform. It appears that it always reports that it locked a file, even when the file is locked by another lock_file() in a separate application.
I think I know why. In be_machine.c, inside of lock_file(), I find:
#if defined(EMINGW) r = 0; // TODO: FOR NOW! #else // defined EMINGW r = lock(fd, first, last - first + 1); #endif // defined EMINGW
...and hg blame tells me that "NOW" was quite a while ago:
jeremy Wed Apr 29 16:24:43 2009 +0000: r = 0; // TODO: FOR NOW!
I suspect we should convert the FILE* to a HANDLE using _get_osfhandle, and then use LockFile on Windows.
Matt