If you want flock to return immediately rather than wait for a lock to become free, you need a 'non-blocking' lock. eg:
flock LOCKFILE, LOCK_EX | LOCK_NB or die;A trick I learned from Dominus is to open $0 for reading and lock it rather than creating a separate file for locking.
In reply to Re: Question about Flock and die
by grantm
in thread Question about Flock and die
by acarvalh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |