diff options
author | intrigeri <intrigeri@boum.org> | 2008-11-12 01:08:57 +0100 |
---|---|---|
committer | intrigeri <intrigeri@boum.org> | 2008-11-12 01:08:57 +0100 |
commit | b19d0d3d245c7c2b605ac6c972c73c909a941db4 (patch) | |
tree | 4e8b120402eae5ebd2387f3c4439da77df8c8b99 /IkiWiki.pm | |
parent | ef536f46bdeee120c7a805d92490db5769ed372f (diff) | |
parent | 3937e1fb1679ab6ebdf3a00f52187e3581691f3f (diff) |
Merge commit 'upstream/po' into prv/po
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r-- | IkiWiki.pm | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index dc9b66344..d949566d8 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1280,8 +1280,7 @@ sub indexlink () { #{{{ my $wikilock; -sub lockwiki (;$) { #{{{ - my $wait=@_ ? shift : 1; +sub lockwiki () { #{{{ # Take an exclusive lock on the wiki to prevent multiple concurrent # run issues. The lock will be dropped on program exit. if (! -d $config{wikistatedir}) { @@ -1289,20 +1288,8 @@ sub lockwiki (;$) { #{{{ } open($wikilock, '>', "$config{wikistatedir}/lockfile") || error ("cannot write to $config{wikistatedir}/lockfile: $!"); - if (! flock($wikilock, 2 | 4)) { # LOCK_EX | LOCK_NB - if ($wait) { - debug("wiki seems to be locked, waiting for lock"); - my $wait=600; # arbitrary, but don't hang forever to - # prevent process pileup - for (1..$wait) { - return if flock($wikilock, 2 | 4); - sleep 1; - } - error("wiki is locked; waited $wait seconds without lock being freed (possible stuck process or stale lock?)"); - } - else { - return 0; - } + if (! flock($wikilock, 2)) { # LOCK_EX + error("failed to get lock"); } return 1; } #}}} |