| Next | File Locking | 9 |
open F, "> somefile" or die ...;
flock F, LOCK_EX or die ...;
# Now write F
close F;
The open call erases the file before the process has the lock
Any other process reading or writing the file is going to get a bad surprise
By the time this process obtains the lock, it's too late
It's like taking a dump on someone's doorstep
And then ringing the bell and asking for toilet paper
| Next | ![]() |
Copyright © 2003 M. J. Dominus |