can't understand flock()
I've scoured over manual page for flock on
http://in2.php.net/flock but
I can't understand a few things:
1. will flock wait until a different process releases the lock ?
2. please clarify this line:
" If you don't want flock() to block while locking, add LOCK_NB "
what does "block" mean above?
I'd like to use flock() in a manner that when locking attempt fails on
a file (maybe it is alreadly locked by some other process) then the
script wouldn't wait but go on and do something, eg: close the file.
Thanks
Mike
.
Relevant Pages
- Re: UW imap-2006b: 64 bit problem
... UW imapd is obliged> to do considerable more work on SVR4 systems than it does on BSD and> Linux systems which offer flock() locking as an alternative to POSIX> locking. ... IEEE Std 1003.1-1988 requires that all fcntl() locks associated with a file for a given process are removed when *any* file descriptor for that file is closed by that process. ... Put another way, before any library routine opens a file, it must be aware of what files the application and any other libraries have open and locked; otherwise the library routine will remove the lock unexpectedly when it closes the file. ... (comp.mail.imap) - Re: Whats up with our stdout?
... both fcntllocking and flockfail in my ... nfs-mounted without nolockd, and also without rpc.lockd or rpc.statd. ... nfs without the rpc daemons really doesn't support remote locking, ... flock() from failing and other times gave a hung flock. ... (freebsd-arch) - Re: Unable to lock a file to stop sendmail writing to it
... meaning of flock(). ... the nature of an flock() lock is advisory. ... That's probably because sendmail doesn't use flock on the mailboxes. ... It might use flock locking, fcntl locking or create a lockfile. ... (comp.lang.perl.misc) - Re: question about forked processes writing to the same file
... Gunnar Hjalmarsson wrote: ... >> i think things are going well with the flock. ... still, i have the code written in such a way that i'm opening, locking, ... (comp.lang.perl.misc) - Re: Meet the flocker
... Always use the constants in Fcntl.pm for the flags to flock and seek. ... separate lockfile but then using flock on it is when the resource you're ... locking is not a regular file, so you can't flock it directly. ... sure to unlock by unlinking the lockfile, unlike a flock lock which the ... (comp.lang.perl.misc) |
|