diff options
author | Stefan Metzmacher <metze@samba.org> | 2009-03-16 15:47:57 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2009-03-18 07:00:39 +0100 |
commit | b659daf81f31678f7447545d015bd9d1db8811b9 (patch) | |
tree | 205f5329746e3907349f5ee70175d2616a273d27 | |
parent | 339ea0503d5ce3bf85cf61528956345c73c668c6 (diff) | |
download | samba-b659daf81f31678f7447545d015bd9d1db8811b9.tar.gz samba-b659daf81f31678f7447545d015bd9d1db8811b9.tar.bz2 samba-b659daf81f31678f7447545d015bd9d1db8811b9.zip |
s3:printing: use tevent_loop_wait() instead of manual looping
metze
-rw-r--r-- | source3/printing/printing.c | 56 |
1 files changed, 6 insertions, 50 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 7dd5e48b1a..8524cfb2bd 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -1428,6 +1428,7 @@ void start_background_queue(void) if(background_lpq_updater_pid == 0) { struct tevent_fd *fde; + int ret; /* Child. */ DEBUG(5,("start_background_queue: background LPQ thread started\n")); @@ -1464,56 +1465,11 @@ void start_background_queue(void) } DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n")); - while (1) { - fd_set r_fds, w_fds; - int ret; - struct timeval to; - int maxfd = 0; - - /* Process a signal and timed events now... */ - if (run_events(smbd_event_context(), 0, NULL, NULL)) { - continue; - } - - to.tv_sec = SMBD_SELECT_TIMEOUT; - to.tv_usec = 0; - - /* - * Setup the select fd sets. - */ - - FD_ZERO(&r_fds); - FD_ZERO(&w_fds); - - /* - * Are there any timed events waiting ? If so, ensure we don't - * select for longer than it would take to wait for them. - */ - - { - struct timeval now; - GetTimeOfDay(&now); - - event_add_to_select_args(smbd_event_context(), &now, - &r_fds, &w_fds, &to, &maxfd); - } - - ret = sys_select(maxfd, &r_fds, &w_fds, NULL, &to); - - /* - * If pause_pipe[1] is closed it means the parent smbd - * and children exited or aborted. If sys_select() - * failed, then something more sinister is wrong - */ - if ((ret < 0) || - (ret == 1 && FD_ISSET(pause_pipe[1], &r_fds))) { - exit_server_cleanly(NULL); - } - - if (run_events(smbd_event_context(), ret, &r_fds, &w_fds)) { - continue; - } - } + ret = tevent_loop_wait(smbd_event_context()); + /* should not be reached */ + DEBUG(0,("background_queue: tevent_loop_wait() exited with %d - %s\n", + ret, (ret == 0) ? "out of events" : strerror(errno))); + exit(1); } close(pause_pipe[1]); |