Ignore:
Timestamp:
03/03/10 22:50:58 (14 years ago)
Author:
nanardon
Message:
  • use lock on base files based to ensure data are not read while another process write it
File:
1 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts/lib/LATMOS/Accounts/Synchro.pm

    r668 r815  
    88use LATMOS::Accounts::Log; 
    99use LATMOS::Accounts::Utils qw(exec_command); 
     10use Fcntl qw(:flock); 
    1011 
    1112=head1 NAME 
     
    143144} 
    144145 
    145 use Fcntl qw(:flock); 
    146  
    147146sub lock { 
    148147    my ($self) = @_; 
    149148 
    150149    $self->{lock}{handle} and return 1; 
     150    la_log(LA_DEBUG, "Trying to lock (pid $$)"); 
    151151    if ($self->{options}{state_dir}) { 
    152152        my $lockfile = $self->{options}{state_dir} . '/synclock'; 
     
    155155        $self->{lock}{handle} = $handle; 
    156156        $self->{lock}{filename} = $lockfile; 
     157        la_log(LA_DEBUG, "lock done (pid $$)"); 
    157158        return 1; 
    158159    } else { return 1 } 
Note: See TracChangeset for help on using the changeset viewer.