summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2004-05-18 08:48:29 +0000
committerfukachan <fukachan>2004-05-18 08:48:29 +0000
commit3eb6b30c877abdfe5cbc23d9b3c2c98de50e1e3b (patch)
tree1435cf22f4a1adee9bfb5ef347f8fa84c0f033ef
parent5da33e60f22161272e738361b3d9f938419eeaf6 (diff)
downloadfml8-3eb6b30c877abdfe5cbc23d9b3c2c98de50e1e3b.tar.gz
fml8-3eb6b30c877abdfe5cbc23d9b3c2c98de50e1e3b.tar.bz2
fml8-3eb6b30c877abdfe5cbc23d9b3c2c98de50e1e3b.zip
support lock({ lock_before_runnable => yes }) extension.
FML::Process::Distribute needs such option to own the current article delivery by itself to distinct it from queue flush system on other processes.
-rw-r--r--fml/lib/Mail/Delivery/Queue.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/fml/lib/Mail/Delivery/Queue.pm b/fml/lib/Mail/Delivery/Queue.pm
index 5d99d790..ec2858e1 100644
--- a/fml/lib/Mail/Delivery/Queue.pm
+++ b/fml/lib/Mail/Delivery/Queue.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: Queue.pm,v 1.32 2004/01/24 09:03:57 fukachan Exp $
+# $FML: Queue.pm,v 1.33 2004/02/15 04:38:36 fukachan Exp $
#
package Mail::Delivery::Queue;
@@ -308,8 +308,10 @@ use Fcntl qw(:DEFAULT :flock);
sub lock
{
my ($self, $args) = @_;
- my $fh = new FileHandle $self->{ _active_qf };
my $wait = defined $args->{ wait } ? $args->{ wait } : 10;
+ my $prep = defined $args->{ lock_before_runnable } ? 1 : 0;
+ my $file = $prep ? $self->{ _new_qf } : $self->{ _active_qf };
+ my $fh = new FileHandle $file;
eval {
local($SIG{ALRM}) = sub { croak("lock timeout");};