|
|
#include "mit-copyright.h"
Go to the source code of this file.
Defines | |
#define | MAX_SOURCES 32 |
Functions | |
void | mux_init () |
void | mux_add_input_source () |
void | mux_delete_input_source () |
void | mux_loop () |
Variables | |
int | mux_end_loop_p |
|
|
|
Referenced by jabber_init(), jwgc_init(), and X_driver_init(). |
|
Referenced by jab_on_state_handler(). |
|
Definition at line 67 of file mux.c. Referenced by main(). 00068 { 00069 int i; 00070 00071 FD_ZERO(&input_sources); 00072 00073 for (i = 0; i < MAX_SOURCES; i++) 00074 input_handler[i] = NULL; 00075 00076 have_tty = check_tty(); 00077 }
|
|
Definition at line 129 of file mux.c. References dPoll, dprintf(), errno, mux_end_loop_p, and NULL. Referenced by main(). 00130 { 00131 int i; 00132 fd_set input_sources_copy; 00133 struct timeval tv; 00134 00135 mux_end_loop_p = 0; 00136 00137 for (;;) { 00138 /* 00139 * Exit if mux_end_loop_p has been set to true by a handler: 00140 */ 00141 if (mux_end_loop_p) 00142 break; 00143 00144 if (have_tty) { 00145 tv.tv_sec = 10; 00146 tv.tv_usec = 0; 00147 } 00148 else { 00149 tv.tv_sec = tv.tv_usec = 0; 00150 } 00151 00152 /* 00153 * Do a select on all the file descriptors we care about to 00154 * wait until at least one of them has input available: 00155 */ 00156 input_sources_copy = input_sources; 00157 00158 i = select(max_source + 1, &input_sources_copy, (fd_set *) 0, 00159 (fd_set *) NULL, have_tty ? &tv : (struct timeval *) 0); 00160 00161 if (i == -1) { 00162 if (errno == EINTR) 00163 continue; /* on a signal restart 00164 * checking mux_loop_end_p */ 00165 /* 00166 * else FATAL_TRAP( errno, "while selecting" ); 00167 */ 00168 } 00169 else if (i == 0) { 00170 if (have_tty && !check_tty()) { 00171 mux_end_loop_p = 1; 00172 continue; 00173 } 00174 } 00175 00176 /* 00177 * Call all input handlers whose corresponding file descriptors have 00178 * input: 00179 */ 00180 for (i = 0; i <= max_source; i++) 00181 if (FD_ISSET(i, &input_sources_copy) && input_handler[i]) { 00182 dprintf(dPoll, "mux_loop...activity on fd %d, calling %x(%x)\n", 00183 i, input_handler[i], input_handler_arg[i]); 00184 input_handler[i] (input_handler_arg[i]); 00185 } 00186 } 00187 }
|
|
Definition at line 31 of file mux.c. Referenced by jwg_on_event_handler(), and mux_loop(). |
Last updated at Tue Dec 18 21:07:42 PST 2007. | This site and project hosted by... |