toniax has asked for the wisdom of the Perl Monks concerning the following question:
use Fcntl qw(:flock); my $file = '/home/X/public_html/filelock'; my $SEMAPHORE = "$file.lck"; open(LOCK, ">$SEMAPHORE") || die $!; flock(LOCK, LOCK_EX); unless (-e "file.html") { open (HTMLFILE,">file.html"); require 'html_head_page.pl'; close (HTMLFILE); close(LOCK); unlink("$SEMAPHORE"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Race conditions
by ikegami (Patriarch) on Nov 16, 2010 at 18:48 UTC | |
by toniax (Scribe) on Nov 16, 2010 at 23:31 UTC | |
by ikegami (Patriarch) on Nov 16, 2010 at 23:45 UTC | |
by toniax (Scribe) on Nov 16, 2010 at 23:59 UTC | |
|
Re: Race conditions
by anonymized user 468275 (Curate) on Nov 16, 2010 at 16:08 UTC | |
by JavaFan (Canon) on Nov 16, 2010 at 16:54 UTC | |
by toniax (Scribe) on Nov 16, 2010 at 19:22 UTC | |
|
Re: Race conditions
by happy.barney (Friar) on Nov 16, 2010 at 17:27 UTC |