file locking wrappers for GLib
Submitted by Tor Lillqvist
Link to original bug (#307131)
Description
Wrappers for file locking would fit nicely into GLib. Many of the GNOME libraries have essentially duplicated code snippets for this, and especially as they are ported to Win32, it's tiresome to do the same porting several times.
IMHO it would be enough, at least as a start, to just have API to lock the whole of the file, test if a file is locked, and unlock. The locking API could have parameters to specify whether to retry the lock, how many times to retry, and with what interval (possibly random).
One problematic issue would be what behaviour to specify or guarantee in multiple thread cases. If I unerstand the lockf() spcification correctly, locks are per-thread. The Win32 LockFile() documentation on the other hand talks only about processes.
Version: 2.6.x