Next | File Locking | 5 |
# Process A
open DATAFILE, "+< $datafile" or die ...; flock DATAFILE, LOCK_EX;
seek DATAFILE, 0, 2; print DATAFILE, $newdata;
close DATAFILE;
# do something else for awhile
Using LOCK_UN is almost always a mistake
LOCK_UN should be considered for experts only
In many ordinary situations, the simplest solution is to close the handle
This flushes the buffer and releases the lock
Next | Copyright © 2003 M. J. Dominus |