X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/1182760af1a5a403b5d943d676e8b6a7ab9b1dd5..2427a7a4ff1fe48d61d649a0c1618f3528a95231:/selfforum-cgi/shared/Lock.pm diff --git a/selfforum-cgi/shared/Lock.pm b/selfforum-cgi/shared/Lock.pm index 38823af..f3291c6 100644 --- a/selfforum-cgi/shared/Lock.pm +++ b/selfforum-cgi/shared/Lock.pm @@ -11,6 +11,7 @@ package Lock; ################################################################################ use strict; +use Carp; use vars qw( @EXPORT_OK %EXPORT_TAGS @@ -147,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 @@ -166,7 +167,7 @@ sub w_write_lock_file ($;$) { # unless (&simple_unlock (&reffile($filename),$timeout)) { &simple_unlock($filename,$timeout); - return; + return 0; } sleep(1); } @@ -381,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 @@ -389,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 @@ -401,7 +402,7 @@ sub x_write_lock_file ($;$) { # unless (&simple_unlock (&reffile($filename),$timeout)) { &simple_unlock($filename,$timeout); - return; + return 0; } sleep(1); } @@ -554,6 +555,7 @@ sub masterlockfile ($) { &lockfile(&masterfile($_[0])); } sub masterfile ($) { + confess unless defined $_[0]; "$_[0].master"; } @@ -841,4 +843,4 @@ BEGIN { # # -### end of Lock ################################################################ +### end of Lock ################################################################ \ No newline at end of file