File locking is impossible in Windows? SOLUTION

elbertlev at hotmail.com elbertlev at hotmail.com
Wed Dec 22 13:45:10 EST 2004


Sure it will do if one of the processes needs read access only.

Scenario when you need shared rw acces with locking:
In the file you have "records" say 30 bytes long, 2 processes are
reading/writing these records by: lock-read-unlock or lock-write-unlock
. Both processes have to open the file with rw access and the third
process can overwrite the locked file. Actually the common method to
prevent file from been overwritten is: lock the region outside the
file. Such feacure is added to lock/unlock namely for this purpose.

You found the bug in WIN32.

In fact the file locked and overwritten hav ALL BYTES ZERO and the
length of the copyed file.




More information about the Python-list mailing list