Ignore:
Timestamp:
May 26, 2009, 9:44:50 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 branch to 3.2.6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.2.x/source/printing/printing.c

    r141 r228  
    13951395void start_background_queue(void)
    13961396{
     1397        /* Use local variables for this as we don't
     1398         * need to save the parent side of this, just
     1399         * ensure it closes when the process exits.
     1400         */
     1401        int pause_pipe[2];
     1402
    13971403        DEBUG(3,("start_background_queue: Starting background LPQ thread\n"));
     1404
     1405        if (pipe(pause_pipe) == -1) {
     1406                DEBUG(5,("start_background_queue: cannot create pipe. %s\n", strerror(errno) ));
     1407                exit(1);
     1408        }
     1409
    13981410        background_lpq_updater_pid = sys_fork();
    13991411
     
    14071419                DEBUG(5,("start_background_queue: background LPQ thread started\n"));
    14081420
     1421                close(pause_pipe[0]);
     1422                pause_pipe[0] = -1;
     1423
    14091424                if (!reinit_after_fork(smbd_messaging_context(), true)) {
    14101425                        DEBUG(0,("reinit_after_fork() failed\n"));
     
    14211436                messaging_register(smbd_messaging_context(), NULL,
    14221437                                   MSG_PRINTER_UPDATE, print_queue_receive);
    1423                
     1438
    14241439                DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n"));
    14251440                while (1) {
    1426                         pause();
    1427                        
     1441                        fd_set pause_fds;
     1442                        int pause_select;
     1443
     1444                        FD_ZERO(&pause_fds);
     1445                        FD_SET(pause_pipe[1], &pause_fds);
     1446                        pause_select = sys_select(pause_pipe[1]+1, &pause_fds, NULL, NULL, NULL);
     1447                        /* If pause_pipe[0] is closed it means the parent smbd
     1448                         * and children exited or aborted. */
     1449                        if (pause_select == 1) {
     1450                                exit_server_cleanly(NULL);
     1451                        }
     1452
    14281453                        /* check for some essential signals first */
    1429                        
     1454
    14301455                        if (got_sig_term) {
    14311456                                exit_server_cleanly(NULL);
     
    14381463                                reload_after_sighup = 0;
    14391464                        }
    1440                        
     1465
    14411466                        /* now check for messages */
    1442                        
     1467
    14431468                        DEBUG(10,("start_background_queue: background LPQ thread got a message\n"));
    14441469                        message_dispatch(smbd_messaging_context());
     
    14501475                }
    14511476        }
     1477
     1478        close(pause_pipe[1]);
    14521479}
    14531480
Note: See TracChangeset for help on using the changeset viewer.