[lug] Polling a file under linux
bgiles at coyotesong.com
Mon Apr 21 13:32:35 MDT 2003
Ed Hill wrote:
> 2) the potential *RACE CONDITION* of having a partially-edited
> config file is (largely) avoided.
> Think about it. The second problem is non-trivial. While a config file
> is being edited, it could easily contain incomplete information.
flock(), using the cached previous contents if you can't obtain a
shared lock on the file.
You still need to use an editor that gets an exclusive lock on the
files it edits, but that should be standard behavior in any decent
But overall I agree with the suggestion that you just reread the
file whenever you get HUP'd.
More information about the LUG