in reply to Can flock occasionally fail on systems that support file locking?
man 2 flock lists only one error condition:
EWOULDBLOCK The file is locked and the LOCK_NB flag was selected.As cfreak suggests, some process (maybe yours) already has the lock.
Seeing your reply to cfreak, yes, a cgi environment may well be running more than one instance of your script. If LOCK_NB is not set, one instance will wait until the other lets go.
Update: Calling flock as flock FH, $opts or warn $!; will tell you what error is set. I don't understand why LOCK_NB is necessary to you. For most purposes, the blocking form is preferred. The effect is to sleep until the file is available.
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Can flock occasionally fail on systems that support file locking?
by rzward (Monk) on Jul 10, 2003 at 15:06 UTC |