summaryrefslogtreecommitdiff
path: root/fml
diff options
context:
space:
mode:
authorfukachan <fukachan>2004-04-10 12:42:40 +0000
committerfukachan <fukachan>2004-04-10 12:42:40 +0000
commit4537e1629319dcb5ef81f4d44262a5f1a14f0847 (patch)
treec5ecb066273d1f531af95c23ad66bd5951d7a0b7 /fml
parentefa7d18afb61a948ad494594fcc5c144665c2d36 (diff)
downloadfml8-4537e1629319dcb5ef81f4d44262a5f1a14f0847.tar.gz
fml8-4537e1629319dcb5ef81f4d44262a5f1a14f0847.tar.bz2
fml8-4537e1629319dcb5ef81f4d44262a5f1a14f0847.zip
IO::Adapter based lock system
Diffstat (limited to 'fml')
-rw-r--r--fml/lib/FML/Process/Kernel.pm24
1 files changed, 13 insertions, 11 deletions
diff --git a/fml/lib/FML/Process/Kernel.pm b/fml/lib/FML/Process/Kernel.pm
index fc038779..14cc0f74 100644
--- a/fml/lib/FML/Process/Kernel.pm
+++ b/fml/lib/FML/Process/Kernel.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Kernel.pm,v 1.222 2004/03/23 06:34:16 fukachan Exp $
+# $FML: Kernel.pm,v 1.223 2004/04/02 11:56:26 fukachan Exp $
#
package FML::Process::Kernel;
@@ -14,7 +14,7 @@ use Carp;
use vars qw(@ISA @Tmpfiles $TmpFileCounter %LockInfo);
use File::Spec;
-use File::SimpleLock;
+use IO::Adapter;
use FML::Process::Flow;
use FML::Parse;
use FML::Header;
@@ -319,17 +319,19 @@ sub lock
# initialize
($channel, $lock_file) = $curproc->_lock_init($channel);
- require File::SimpleLock;
- my $lockobj = $pcb->get('lock', $channel) || new File::SimpleLock;
+ # require File::SimpleLock;
+ # my $lockobj = $pcb->get('lock', $channel) || new File::SimpleLock;
+ my $map = sprintf("file:%s", $lock_file);
+ my $io = $pcb->get('lock', $channel) || new IO::Adapter $map;
- my $r = $lockobj->lock( { file => $lock_file } );
+ my $r = $io->lock( { file => $lock_file } );
if ($r) {
my $t = time - $time_in;
if ($t > 1) {
- $curproc->log("lock requires $t sec.");
+ $curproc->log("lock channel=$channel requires $t sec.");
}
- $pcb->set('lock', $channel, $lockobj);
+ $pcb->set('lock', $channel, $io);
$LockInfo{ $channel } = 1;
$curproc->log("lock channel=$channel");
}
@@ -353,11 +355,11 @@ sub unlock
# initialize
($channel, $lock_file) = $curproc->_lock_init($channel);
- my $pcb = $curproc->pcb();
- my $lockobj = $pcb->get('lock', $channel);
+ my $pcb = $curproc->pcb();
+ my $io = $pcb->get('lock', $channel);
- if (defined $lockobj) {
- my $r = $lockobj->unlock( { file => $lock_file } );
+ if (defined $io) {
+ my $r = $io->unlock( { file => $lock_file } );
if ($r) {
my $t = time - $time_in;
if ($t > 1) {