Diff for /loncom/lonmaxima between versions 1.13 and 1.14

version 1.13, 2006/03/08 12:57:30 version 1.14, 2006/03/08 14:22:14
Line 65  sub REAPER {                        # ta Line 65  sub REAPER {                        # ta
     $SIG{CHLD} = \&REAPER;      $SIG{CHLD} = \&REAPER;
     my $pid = wait;      my $pid = wait;
     $children--;      $children--;
       &logthis("Child $pid for port or process $children{$pid} died");
     delete($usedmaximaports{$children{$pid}});      delete($usedmaximaports{$children{$pid}});
     delete($children{$pid});      delete($children{$pid});
 }  }
Line 232  while (1) { Line 233  while (1) {
     for (my $i = $children; $i < $PREFORK; $i++) {      for (my $i = $children; $i < $PREFORK; $i++) {
         &status('Parent process, starting child');          &status('Parent process, starting child');
         my $newport;          my $newport;
         foreach $newport ($STARTPORT .. $STARTPORT+$PREFORK-1) {          &logthis("Current pool: ".join(', ',keys %usedmaximaports));
             if (!defined($usedmaximaports{$newport})) { last; }          foreach my $testport ($STARTPORT .. $STARTPORT+$PREFORK-1) {
               if (!$usedmaximaports{$testport}) { $newport=$testport; }
           }
           if ($newport) {
              &make_new_child($server,$newport);           # top up the child pool
         }          }
         &make_new_child($server,$newport);           # top up the child pool  
     }      }
 }  }
                                                                                                                                                                   
Line 255  sub make_new_child { Line 259  sub make_new_child {
             or die("Can't unblock SIGINT for fork: $!\n");              or die("Can't unblock SIGINT for fork: $!\n");
         $children{$pid} = $maximaport;          $children{$pid} = $maximaport;
         $children++;          $children++;
           $usedmaximaports{$maximaport}=1;
         return;          return;
     } else {      } else {
           &logthis("Starting child on port $maximaport");
         # Child can *not* return from this subroutine.          # Child can *not* return from this subroutine.
         $SIG{INT} = 'DEFAULT';      # make SIGINT kill us as it did before          $SIG{INT} = 'DEFAULT';      # make SIGINT kill us as it did before
             
Line 273  sub make_new_child { Line 279  sub make_new_child {
                         or die "making socket: $@\n";                          or die "making socket: $@\n";
         &nonblock($maximaserver);          &nonblock($maximaserver);
         my $maximaselect=IO::Select->new($maximaserver);          my $maximaselect=IO::Select->new($maximaserver);
           sleep(2);
   
         # open MAXIMA to talk to that port          # open MAXIMA to talk to that port
         my ($cmd_in, $cmd_out, $cmd_err);          my ($cmd_in, $cmd_out, $cmd_err);
         my $maximapid = open3($cmd_in, $cmd_out, $cmd_err, "maxima -s $maximaport");          my $maximapid = open3($cmd_in, $cmd_out, $cmd_err, "maxima -s $maximaport");
         $children{$maximapid} = 1;          $children{$maximapid} = "Maxima $maximapid port $maximaport";
         my $prompt=<$cmd_out>;          my $prompt=<$cmd_out>;
         &logthis("Maxima $maximapid: $prompt");          &logthis("Maxima $maximapid: $prompt");
   

Removed from v.1.13  
changed lines
  Added in v.1.14


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>