Locking a file for race conditons perl -


i working on script no reason spawns 2 processes when run. combat wrote file lock routine. because these processes running @ same time not seem work @ all. missing here.

my $lockfile = '/tmp/lockfile'; $fhpid; sub bailout {     print "$0 running. exiting.\n";     print "(file '$lockfile' locked).\n";     exit(1); } open($fhpid, '>', $lockfile) or die "error: open '$lockfile': $!"; flock($fhpid, lock_ex|lock_nb) or bailout(); 


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -