Next Welcome to my ~/bin 91

printd

     sub mainloop {
      MAINLOOP:
       while (1) {
         sleep ($NEXTOP - time()) while $NEXTOP > time();
         %CONF = load_conf($CONFIG);
         my @QUEUE = read_spoold($CONF{spooldir});
         if (@QUEUE == 0) {          # empty queue
     #      $NEXTOP = time() + 2;     # try again in two seconds
     #      next;
           # It seems there is a race condition here.
           # printd #1 reads the queue and finds that it is empty.
           # The someone prints a document, which writes a new queue item
           # and starts printd #2.  printd #2 exits because printd #1 is 
           # still running.  Then printd #1 exits because the queue was empty.
           # Now the document is never printed.
           print STDERR "queue empty; exiting\n" if $CONF{debug_printd};
           exit 0;
         }


Next Menu Copyright © 2005 M. J. Dominus