aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorKim F. Storm2004-11-01 11:04:37 +0000
committerKim F. Storm2004-11-01 11:04:37 +0000
commitbad49fc7c2a55bd614979cf0e9c59b396ac2beb7 (patch)
tree354b8949028a4ff9789a3ad52abe706c671cdb75 /src/process.c
parentf6749d5d75ab07f8e63781ee396c1a89d8bd4305 (diff)
downloademacs-bad49fc7c2a55bd614979cf0e9c59b396ac2beb7.tar.gz
emacs-bad49fc7c2a55bd614979cf0e9c59b396ac2beb7.zip
(connect_wait_mask, num_pending_connects): Only
declare and use them if NON_BLOCKING_CONNECT is defined. (IF_NON_BLOCKING_CONNECT): New helper macro. (wait_reading_process_output): Only declare and use local vars Connecting and check_connect when NON_BLOCKING_CONNECT is defined. (init_process): Initialize them if NON_BLOCKING_CONNECT defined.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c48
1 files changed, 41 insertions, 7 deletions
diff --git a/src/process.c b/src/process.c
index b63c730b480..bebcd577e9e 100644
--- a/src/process.c
+++ b/src/process.c
@@ -310,6 +310,7 @@ static SELECT_TYPE non_keyboard_wait_mask;
310 310
311static SELECT_TYPE non_process_wait_mask; 311static SELECT_TYPE non_process_wait_mask;
312 312
313#ifdef NON_BLOCKING_CONNECT
313/* Mask of bits indicating the descriptors that we wait for connect to 314/* Mask of bits indicating the descriptors that we wait for connect to
314 complete on. Once they complete, they are removed from this mask 315 complete on. Once they complete, they are removed from this mask
315 and added to the input_wait_mask and non_keyboard_wait_mask. */ 316 and added to the input_wait_mask and non_keyboard_wait_mask. */
@@ -319,6 +320,11 @@ static SELECT_TYPE connect_wait_mask;
319/* Number of bits set in connect_wait_mask. */ 320/* Number of bits set in connect_wait_mask. */
320static int num_pending_connects; 321static int num_pending_connects;
321 322
323#define IF_NON_BLOCKING_CONNECT(s) s
324#else
325#define IF_NON_BLOCKING_CONNECT(s)
326#endif
327
322/* The largest descriptor currently in use for a process object. */ 328/* The largest descriptor currently in use for a process object. */
323static int max_process_desc; 329static int max_process_desc;
324 330
@@ -3672,12 +3678,14 @@ deactivate_process (proc)
3672 chan_process[inchannel] = Qnil; 3678 chan_process[inchannel] = Qnil;
3673 FD_CLR (inchannel, &input_wait_mask); 3679 FD_CLR (inchannel, &input_wait_mask);
3674 FD_CLR (inchannel, &non_keyboard_wait_mask); 3680 FD_CLR (inchannel, &non_keyboard_wait_mask);
3681#ifdef NON_BLOCKING_CONNECT
3675 if (FD_ISSET (inchannel, &connect_wait_mask)) 3682 if (FD_ISSET (inchannel, &connect_wait_mask))
3676 { 3683 {
3677 FD_CLR (inchannel, &connect_wait_mask); 3684 FD_CLR (inchannel, &connect_wait_mask);
3678 if (--num_pending_connects < 0) 3685 if (--num_pending_connects < 0)
3679 abort (); 3686 abort ();
3680 } 3687 }
3688#endif
3681 if (inchannel == max_process_desc) 3689 if (inchannel == max_process_desc)
3682 { 3690 {
3683 int i; 3691 int i;
@@ -4038,8 +4046,11 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4038{ 4046{
4039 register int channel, nfds; 4047 register int channel, nfds;
4040 SELECT_TYPE Available; 4048 SELECT_TYPE Available;
4049#ifdef NON_BLOCKING_CONNECT
4041 SELECT_TYPE Connecting; 4050 SELECT_TYPE Connecting;
4042 int check_connect, check_delay, no_avail; 4051 int check_connect;
4052#endif
4053 int check_delay, no_avail;
4043 int xerrno; 4054 int xerrno;
4044 Lisp_Object proc; 4055 Lisp_Object proc;
4045 EMACS_TIME timeout, end_time; 4056 EMACS_TIME timeout, end_time;
@@ -4050,7 +4061,9 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4050 int saved_waiting_for_user_input_p = waiting_for_user_input_p; 4061 int saved_waiting_for_user_input_p = waiting_for_user_input_p;
4051 4062
4052 FD_ZERO (&Available); 4063 FD_ZERO (&Available);
4064#ifdef NON_BLOCKING_CONNECT
4053 FD_ZERO (&Connecting); 4065 FD_ZERO (&Connecting);
4066#endif
4054 4067
4055 /* If wait_proc is a process to watch, set wait_channel accordingly. */ 4068 /* If wait_proc is a process to watch, set wait_channel accordingly. */
4056 if (wait_proc != NULL) 4069 if (wait_proc != NULL)
@@ -4187,7 +4200,10 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4187 timeout to get our attention. */ 4200 timeout to get our attention. */
4188 if (update_tick != process_tick && do_display) 4201 if (update_tick != process_tick && do_display)
4189 { 4202 {
4190 SELECT_TYPE Atemp, Ctemp; 4203 SELECT_TYPE Atemp;
4204#ifdef NON_BLOCKING_CONNECT
4205 SELECT_TYPE Ctemp;
4206#endif
4191 4207
4192 Atemp = input_wait_mask; 4208 Atemp = input_wait_mask;
4193#if 0 4209#if 0
@@ -4199,11 +4215,16 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4199 */ 4215 */
4200 FD_CLR (0, &Atemp); 4216 FD_CLR (0, &Atemp);
4201#endif 4217#endif
4202 Ctemp = connect_wait_mask; 4218 IF_NON_BLOCKING_CONNECT (Ctemp = connect_wait_mask);
4219
4203 EMACS_SET_SECS_USECS (timeout, 0, 0); 4220 EMACS_SET_SECS_USECS (timeout, 0, 0);
4204 if ((select (max (max_process_desc, max_keyboard_desc) + 1, 4221 if ((select (max (max_process_desc, max_keyboard_desc) + 1,
4205 &Atemp, 4222 &Atemp,
4223#ifdef NON_BLOCKING_CONNECT
4206 (num_pending_connects > 0 ? &Ctemp : (SELECT_TYPE *)0), 4224 (num_pending_connects > 0 ? &Ctemp : (SELECT_TYPE *)0),
4225#else
4226 (SELECT_TYPE *)0,
4227#endif
4207 (SELECT_TYPE *)0, &timeout) 4228 (SELECT_TYPE *)0, &timeout)
4208 <= 0)) 4229 <= 0))
4209 { 4230 {
@@ -4263,12 +4284,14 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4263 if (XINT (wait_proc->infd) < 0) /* Terminated */ 4284 if (XINT (wait_proc->infd) < 0) /* Terminated */
4264 break; 4285 break;
4265 FD_SET (XINT (wait_proc->infd), &Available); 4286 FD_SET (XINT (wait_proc->infd), &Available);
4266 check_connect = check_delay = 0; 4287 check_delay = 0;
4288 IF_NON_BLOCKING_CONNECT (check_connect = 0);
4267 } 4289 }
4268 else if (!NILP (wait_for_cell)) 4290 else if (!NILP (wait_for_cell))
4269 { 4291 {
4270 Available = non_process_wait_mask; 4292 Available = non_process_wait_mask;
4271 check_connect = check_delay = 0; 4293 check_delay = 0;
4294 IF_NON_BLOCKING_CONNECT (check_connect = 0);
4272 } 4295 }
4273 else 4296 else
4274 { 4297 {
@@ -4276,7 +4299,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4276 Available = non_keyboard_wait_mask; 4299 Available = non_keyboard_wait_mask;
4277 else 4300 else
4278 Available = input_wait_mask; 4301 Available = input_wait_mask;
4279 check_connect = (num_pending_connects > 0); 4302 IF_NON_BLOCKING_CONNECT (check_connect = (num_pending_connects > 0));
4280 check_delay = wait_channel >= 0 ? 0 : process_output_delay_count; 4303 check_delay = wait_channel >= 0 ? 0 : process_output_delay_count;
4281 } 4304 }
4282 4305
@@ -4301,8 +4324,10 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4301 } 4324 }
4302 else 4325 else
4303 { 4326 {
4327#ifdef NON_BLOCKING_CONNECT
4304 if (check_connect) 4328 if (check_connect)
4305 Connecting = connect_wait_mask; 4329 Connecting = connect_wait_mask;
4330#endif
4306 4331
4307#ifdef ADAPTIVE_READ_BUFFERING 4332#ifdef ADAPTIVE_READ_BUFFERING
4308 if (process_output_skip && check_delay > 0) 4333 if (process_output_skip && check_delay > 0)
@@ -4333,7 +4358,11 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4333 4358
4334 nfds = select (max (max_process_desc, max_keyboard_desc) + 1, 4359 nfds = select (max (max_process_desc, max_keyboard_desc) + 1,
4335 &Available, 4360 &Available,
4361#ifdef NON_BLOCKING_CONNECT
4336 (check_connect ? &Connecting : (SELECT_TYPE *)0), 4362 (check_connect ? &Connecting : (SELECT_TYPE *)0),
4363#else
4364 (SELECT_TYPE *)0,
4365#endif
4337 (SELECT_TYPE *)0, &timeout); 4366 (SELECT_TYPE *)0, &timeout);
4338 } 4367 }
4339 4368
@@ -4389,7 +4418,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4389 if (no_avail) 4418 if (no_avail)
4390 { 4419 {
4391 FD_ZERO (&Available); 4420 FD_ZERO (&Available);
4392 check_connect = 0; 4421 IF_NON_BLOCKING_CONNECT (check_connect = 0);
4393 } 4422 }
4394 4423
4395#if defined(sun) && !defined(USG5_4) 4424#if defined(sun) && !defined(USG5_4)
@@ -6628,6 +6657,11 @@ init_process ()
6628 FD_ZERO (&non_process_wait_mask); 6657 FD_ZERO (&non_process_wait_mask);
6629 max_process_desc = 0; 6658 max_process_desc = 0;
6630 6659
6660#ifdef NON_BLOCKING_CONNECT
6661 FD_ZERO (&connect_wait_mask);
6662 num_pending_connects = 0;
6663#endif
6664
6631#ifdef ADAPTIVE_READ_BUFFERING 6665#ifdef ADAPTIVE_READ_BUFFERING
6632 process_output_delay_count = 0; 6666 process_output_delay_count = 0;
6633 process_output_skip = 0; 6667 process_output_skip = 0;