Next | Welcome to my ~/bin | 91 |
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;
As you can see, I have not made up my mind about what it should do here
# 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; }
I eventually decided to have it exit
I did also figure out how to fix the race condition, but I haven't done it yet
Next | Menu | Copyright © 2005 M. J. Dominus |