Gtk2-CV
view release on metacpan or search on metacpan
lib/Gtk2/CV/Jobber.pm view on Meta::CPAN
use Gtk2::CV::Progress;
=item %Gtk2::CV::Jobber::job [READ-ONLY]
Global variable containing all jobs, indexed by full path.
=cut
our %jobs;
our @jobs; # global job order
our %busy; # exists if this path is executing a job
our %hide; # which paths to hide
our %type;
our @type; # type order
our $TEMPLATE; # the AnyEvent::Fork object
my %type_hide;
my $disabled;
lib/Gtk2/CV/Jobber.pm view on Meta::CPAN
my $progress;
sub scheduler {
job:
for my $idx (1 .. (@jobs < 10 ? @jobs : 10)) {
return if $disabled;
my $path = $jobs[-$idx];
next if exists $busy{$path};
my $types = $jobs{$path};
my @types = keys %$types;
if (@types) {
for my $type (@type) {
next unless exists $types->{$type};
my $class = $type{$type}{class};
if ($class_limit{$class}) {
$class_limit{$class}--;
my $job = bless delete $types->{$type}, Gtk2::CV::Jobber::Job::;
$job->{path} = $path;
$job->{type} = $type;
undef $busy{$path};
$job->run;
}
next job;
}
die "FATAL: unknown job type <@types> encountered, aborting.\n";
} else {
delete $jobs{splice @jobs, -$idx, 1, ()}
lib/Gtk2/CV/Jobber.pm view on Meta::CPAN
sub Gtk2::CV::Jobber::Job::finish {
my ($job) = @_;
if (my $slave = delete $job->{slave}) {
$slave->finish ($job);
} else {
unless (delete $job->{event}) {
my $type = $type{$job->{type}};
++$class_limit{$type->{class}};
delete $hide{$job->{path}} if $type->{hide};
delete $busy{$job->{path}};
scheduler;
}
client_update $_[0];
}
}
package Gtk2::CV::Jobber::Client;
( run in 0.325 second using v1.01-cache-2.11-cpan-87723dcf8b7 )