Changeset 228 for branches/samba-3.2.x/source/printing/printing.c
- Timestamp:
- May 26, 2009, 9:44:50 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.2.x/source/printing/printing.c
r141 r228 1395 1395 void start_background_queue(void) 1396 1396 { 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 1397 1403 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 1398 1410 background_lpq_updater_pid = sys_fork(); 1399 1411 … … 1407 1419 DEBUG(5,("start_background_queue: background LPQ thread started\n")); 1408 1420 1421 close(pause_pipe[0]); 1422 pause_pipe[0] = -1; 1423 1409 1424 if (!reinit_after_fork(smbd_messaging_context(), true)) { 1410 1425 DEBUG(0,("reinit_after_fork() failed\n")); … … 1421 1436 messaging_register(smbd_messaging_context(), NULL, 1422 1437 MSG_PRINTER_UPDATE, print_queue_receive); 1423 1438 1424 1439 DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n")); 1425 1440 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 1428 1453 /* check for some essential signals first */ 1429 1454 1430 1455 if (got_sig_term) { 1431 1456 exit_server_cleanly(NULL); … … 1438 1463 reload_after_sighup = 0; 1439 1464 } 1440 1465 1441 1466 /* now check for messages */ 1442 1467 1443 1468 DEBUG(10,("start_background_queue: background LPQ thread got a message\n")); 1444 1469 message_dispatch(smbd_messaging_context()); … … 1450 1475 } 1451 1476 } 1477 1478 close(pause_pipe[1]); 1452 1479 } 1453 1480
Note:
See TracChangeset
for help on using the changeset viewer.