X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/f4e905b815a97cc195eb8b8ab4703d15122ab443..2427a7a4ff1fe48d61d649a0c1618f3528a95231:/selfforum-cgi/shared/Lock.pm?ds=sidebyside diff --git a/selfforum-cgi/shared/Lock.pm b/selfforum-cgi/shared/Lock.pm index f878aea..f3291c6 100644 --- a/selfforum-cgi/shared/Lock.pm +++ b/selfforum-cgi/shared/Lock.pm @@ -12,7 +12,6 @@ package Lock; use strict; use Carp; - use vars qw( @EXPORT_OK %EXPORT_TAGS @@ -149,14 +148,14 @@ sub w_write_lock_file ($;$) { # and wait $timeout seconds for # references == 0 (no shared locks set) # - &simple_lock ($filename,$timeout) or return; + &simple_lock ($filename,$timeout) or return 0; for (0..$timeout) { # lock reference counter # or fail # unless (&simple_lock (&reffile($filename),$timeout)) { &simple_unlock($filename,$timeout); - return; + return 0; } # ready if we have no shared locks @@ -168,7 +167,7 @@ sub w_write_lock_file ($;$) { # unless (&simple_unlock (&reffile($filename),$timeout)) { &simple_unlock($filename,$timeout); - return; + return 0; } sleep(1); } @@ -383,7 +382,7 @@ sub x_write_lock_file ($;$) { # and wait $timeout seconds for # references == 0 (no shared locks set) # - &simple_lock ($filename,$timeout) or return; + &simple_lock ($filename,$timeout) or return 0; for (0..$timeout) { # lock reference counter @@ -391,7 +390,7 @@ sub x_write_lock_file ($;$) { # unless (&simple_lock (&reffile($filename),$timeout)) { &simple_unlock($filename,$timeout); - return; + return 0; } # ready if we have no shared locks @@ -403,7 +402,7 @@ sub x_write_lock_file ($;$) { # unless (&simple_unlock (&reffile($filename),$timeout)) { &simple_unlock($filename,$timeout); - return; + return 0; } sleep(1); } @@ -556,6 +555,7 @@ sub masterlockfile ($) { &lockfile(&masterfile($_[0])); } sub masterfile ($) { + confess unless defined $_[0]; "$_[0].master"; } @@ -843,4 +843,4 @@ BEGIN { # # -### end of Lock ################################################################ +### end of Lock ################################################################ \ No newline at end of file