Subject: | wishlist: non-blocking flock() |
Proc-PID-File-1.3
perl 5.8.0
Redhat GNU/Linux 9
I was having problems with ->alive() when fork()ing which was my problem. The symptom however was the script blocking during Proc::PID::File->read() at flock().
With the attached patch a die() is called instead if the file is already locked.
45,46c45
< flock(FH, LOCK_EX | LOCK_NB)
< || die "pid ".$self->{'path'}." already locked";
---
> flock FH, LOCK_EX;
59,60c58
< flock(FH, LOCK_EX | LOCK_NB)
< || die "pid ".$self->{'path'}." already locked";
---
> flock FH, LOCK_EX;