[Koha-bugs] [Bug 23571] fines.pl may block server

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Feb 21 11:32:36 CET 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23571

--- Comment #12 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
Also, do you know that you can lock a portion of the file?

I have no idea why your code is that complicated, I think you should
investigate this code:

use Modern::Perl;
use Fcntl qw(:flock);
sub is_locked {
    unless ( flock(DATA, LOCK_EX|LOCK_NB) ) {
        return 1;
    }    
    return 0;
}

die "is locked" if is_locked();

say "is not locked! sleeping 5 sec";
sleep(5);

__DATA__
USED BY LOCK - DO NOT REMOVE

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list