Certainly on all platforms there must be *some* locking primitive.  We
just need to figure out the appropiate parameters to fcntl() or flock()
or lockf() on each.
Right.

The Win32 API for locking seems mighty strange to me.

Linux/Unix byte locking is advisory (meaning that one lock can block another lock, but it can't block a read).  Win32 locking is mandatory (at least in the most portable form) so a lock blocks a reader.  To avoid that problem, youlock a byte that you never intend to read (that is, you lock a byte past the end of the file).  Locking past the end-of-file is portable to all Unix/Linux systems that I've seen (that way, you can lock a region of a file before you grow the file).

        -- Korry

Reply via email to