Imported Upstream version 3.3.1
[debian/amanda] / perl / Amanda / MainLoop.pm
index 5fbec198e81b2f8c0ba64526fd90d2611ad3c346..bc505352be7fd280f3bc946842197ad612849f91 100644 (file)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.39
+# Version 2.0.4
 #
 # Do not make changes to this file unless you know what you are doing--modify
 # the SWIG interface file instead.
@@ -498,6 +498,13 @@ To do the same for a single step, add the same keyword to the C<step> invocation
     step immediate => 1,
         connect => sub { .. };
 
+In some case, you want to execute some code when the step finish, it can
+be done by defining a finalize code in define_steps:
+
+    my $steps = define_steps
+           cb_ref => \$finished_cb,
+           finalize => sub { .. };
+
 =head2 JOINING ASYNCHRONOUS "THREADS"
 
 With slow operations, it is often useful to perform multiple operations
@@ -989,6 +996,7 @@ push @EXPORT_OK, "synchronized";
     sub define_steps (@) {
        my (%params) = @_;
        my $cb_ref = $params{'cb_ref'};
+       my $finalize = $params{'finalize'};
        my %steps;
 
        croak "cb_ref is undefined" unless defined $cb_ref;
@@ -1003,6 +1011,7 @@ push @EXPORT_OK, "synchronized";
        $$cb_ref = sub {
            %steps = ();
            $current_steps = undef;
+           $finalize->() if defined($finalize);
            goto $orig_cb;
        };