comparison src/process.c @ 90192:173dee4e2611

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-61 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 353-357) - Update from CVS
author Miles Bader <miles@gnu.org>
date Thu, 09 Jun 2005 07:13:03 +0000
parents 5b029ff3b08d 9bde03db5726
children a1b34dec1104
comparison
equal deleted inserted replaced
90191:c766b49f5bbd 90192:173dee4e2611
270 #ifdef ADAPTIVE_READ_BUFFERING 270 #ifdef ADAPTIVE_READ_BUFFERING
271 #define READ_OUTPUT_DELAY_INCREMENT 10000 271 #define READ_OUTPUT_DELAY_INCREMENT 10000
272 #define READ_OUTPUT_DELAY_MAX (READ_OUTPUT_DELAY_INCREMENT * 5) 272 #define READ_OUTPUT_DELAY_MAX (READ_OUTPUT_DELAY_INCREMENT * 5)
273 #define READ_OUTPUT_DELAY_MAX_MAX (READ_OUTPUT_DELAY_INCREMENT * 7) 273 #define READ_OUTPUT_DELAY_MAX_MAX (READ_OUTPUT_DELAY_INCREMENT * 7)
274 274
275 /* Number of processes which might be delayed. */ 275 /* Number of processes which have a non-zero read_output_delay,
276 and therefore might be delayed for adaptive read buffering. */
276 277
277 static int process_output_delay_count; 278 static int process_output_delay_count;
278 279
279 /* Non-zero if any process has non-nil process_output_skip. */ 280 /* Non-zero if any process has non-nil read_output_skip. */
280 281
281 static int process_output_skip; 282 static int process_output_skip;
282 283
283 /* Non-nil means to delay reading process output to improve buffering. 284 /* Non-nil means to delay reading process output to improve buffering.
284 A value of t means that delay is reset after each send, any other 285 A value of t means that delay is reset after each send, any other
285 non-nil value does not reset the delay. */ 286 non-nil value does not reset the delay. A value of nil disables
287 adaptive read buffering completely. */
286 static Lisp_Object Vprocess_adaptive_read_buffering; 288 static Lisp_Object Vprocess_adaptive_read_buffering;
287 #else 289 #else
288 #define process_output_delay_count 0 290 #define process_output_delay_count 0
289 #endif 291 #endif
290 292
1534 itself; it's all taken care of here. */ 1536 itself; it's all taken care of here. */
1535 record_unwind_protect (start_process_unwind, proc); 1537 record_unwind_protect (start_process_unwind, proc);
1536 1538
1537 XPROCESS (proc)->childp = Qt; 1539 XPROCESS (proc)->childp = Qt;
1538 XPROCESS (proc)->plist = Qnil; 1540 XPROCESS (proc)->plist = Qnil;
1539 XPROCESS (proc)->command_channel_p = Qnil;
1540 XPROCESS (proc)->buffer = buffer; 1541 XPROCESS (proc)->buffer = buffer;
1541 XPROCESS (proc)->sentinel = Qnil; 1542 XPROCESS (proc)->sentinel = Qnil;
1542 XPROCESS (proc)->filter = Qnil; 1543 XPROCESS (proc)->filter = Qnil;
1543 XPROCESS (proc)->filter_multibyte 1544 XPROCESS (proc)->filter_multibyte
1544 = buffer_defaults.enable_multibyte_characters; 1545 = buffer_defaults.enable_multibyte_characters;
4318 if (check_connect) 4319 if (check_connect)
4319 Connecting = connect_wait_mask; 4320 Connecting = connect_wait_mask;
4320 #endif 4321 #endif
4321 4322
4322 #ifdef ADAPTIVE_READ_BUFFERING 4323 #ifdef ADAPTIVE_READ_BUFFERING
4324 /* Set the timeout for adaptive read buffering if any
4325 process has non-nil read_output_skip and non-zero
4326 read_output_delay, and we are not reading output for a
4327 specific wait_channel. It is not executed if
4328 Vprocess_adaptive_read_buffering is nil. */
4323 if (process_output_skip && check_delay > 0) 4329 if (process_output_skip && check_delay > 0)
4324 { 4330 {
4325 int usecs = EMACS_USECS (timeout); 4331 int usecs = EMACS_USECS (timeout);
4326 if (EMACS_SECS (timeout) > 0 || usecs > READ_OUTPUT_DELAY_MAX) 4332 if (EMACS_SECS (timeout) > 0 || usecs > READ_OUTPUT_DELAY_MAX)
4327 usecs = READ_OUTPUT_DELAY_MAX; 4333 usecs = READ_OUTPUT_DELAY_MAX;
4328 for (channel = 0; check_delay > 0 && channel <= max_process_desc; channel++) 4334 for (channel = 0; check_delay > 0 && channel <= max_process_desc; channel++)
4329 { 4335 {
4330 proc = chan_process[channel]; 4336 proc = chan_process[channel];
4331 if (NILP (proc)) 4337 if (NILP (proc))
4332 continue; 4338 continue;
4339 /* Find minimum non-zero read_output_delay among the
4340 processes with non-nil read_output_skip. */
4333 if (XINT (XPROCESS (proc)->read_output_delay) > 0) 4341 if (XINT (XPROCESS (proc)->read_output_delay) > 0)
4334 { 4342 {
4335 check_delay--; 4343 check_delay--;
4336 if (NILP (XPROCESS (proc)->read_output_skip)) 4344 if (NILP (XPROCESS (proc)->read_output_skip))
4337 continue; 4345 continue;
4878 save the same match data in safely recursive fashion. */ 4886 save the same match data in safely recursive fashion. */
4879 if (outer_running_asynch_code) 4887 if (outer_running_asynch_code)
4880 { 4888 {
4881 Lisp_Object tem; 4889 Lisp_Object tem;
4882 /* Don't clobber the CURRENT match data, either! */ 4890 /* Don't clobber the CURRENT match data, either! */
4883 tem = Fmatch_data (Qnil, Qnil); 4891 tem = Fmatch_data (Qnil, Qnil, Qnil);
4884 restore_match_data (); 4892 restore_search_regs ();
4885 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); 4893 record_unwind_save_match_data ();
4886 Fset_match_data (tem); 4894 Fset_match_data (tem, Qt);
4887 } 4895 }
4888 4896
4889 /* For speed, if a search happens within this code, 4897 /* For speed, if a search happens within this code,
4890 save the match data in a special nonrecursive fashion. */ 4898 save the match data in a special nonrecursive fashion. */
4891 running_asynch_code = 1; 4899 running_asynch_code = 1;
4937 Fcons (proc, Fcons (text, Qnil))), 4945 Fcons (proc, Fcons (text, Qnil))),
4938 !NILP (Vdebug_on_error) ? Qnil : Qerror, 4946 !NILP (Vdebug_on_error) ? Qnil : Qerror,
4939 read_process_output_error_handler); 4947 read_process_output_error_handler);
4940 4948
4941 /* If we saved the match data nonrecursively, restore it now. */ 4949 /* If we saved the match data nonrecursively, restore it now. */
4942 restore_match_data (); 4950 restore_search_regs ();
4943 running_asynch_code = outer_running_asynch_code; 4951 running_asynch_code = outer_running_asynch_code;
4944 4952
4945 /* Handling the process output should not deactivate the mark. */ 4953 /* Handling the process output should not deactivate the mark. */
4946 Vdeactivate_mark = odeactivate; 4954 Vdeactivate_mark = odeactivate;
4947 4955
6336 and we already saved the match data nonrecursively, 6344 and we already saved the match data nonrecursively,
6337 save the same match data in safely recursive fashion. */ 6345 save the same match data in safely recursive fashion. */
6338 if (outer_running_asynch_code) 6346 if (outer_running_asynch_code)
6339 { 6347 {
6340 Lisp_Object tem; 6348 Lisp_Object tem;
6341 tem = Fmatch_data (Qnil, Qnil); 6349 tem = Fmatch_data (Qnil, Qnil, Qnil);
6342 restore_match_data (); 6350 restore_search_regs ();
6343 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); 6351 record_unwind_save_match_data ();
6344 Fset_match_data (tem); 6352 Fset_match_data (tem, Qt);
6345 } 6353 }
6346 6354
6347 /* For speed, if a search happens within this code, 6355 /* For speed, if a search happens within this code,
6348 save the match data in a special nonrecursive fashion. */ 6356 save the match data in a special nonrecursive fashion. */
6349 running_asynch_code = 1; 6357 running_asynch_code = 1;
6353 Fcons (proc, Fcons (reason, Qnil))), 6361 Fcons (proc, Fcons (reason, Qnil))),
6354 !NILP (Vdebug_on_error) ? Qnil : Qerror, 6362 !NILP (Vdebug_on_error) ? Qnil : Qerror,
6355 exec_sentinel_error_handler); 6363 exec_sentinel_error_handler);
6356 6364
6357 /* If we saved the match data nonrecursively, restore it now. */ 6365 /* If we saved the match data nonrecursively, restore it now. */
6358 restore_match_data (); 6366 restore_search_regs ();
6359 running_asynch_code = outer_running_asynch_code; 6367 running_asynch_code = outer_running_asynch_code;
6360 6368
6361 Vdeactivate_mark = odeactivate; 6369 Vdeactivate_mark = odeactivate;
6362 6370
6363 /* Restore waiting_for_user_input_p as it was 6371 /* Restore waiting_for_user_input_p as it was
6707 Fprovide (intern ("make-network-process"), subfeatures); 6715 Fprovide (intern ("make-network-process"), subfeatures);
6708 } 6716 }
6709 #endif /* HAVE_SOCKETS */ 6717 #endif /* HAVE_SOCKETS */
6710 6718
6711 #if defined (DARWIN) || defined (MAC_OSX) 6719 #if defined (DARWIN) || defined (MAC_OSX)
6712 /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive 6720 /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive
6713 processes. As such, we only change the default value. */ 6721 processes. As such, we only change the default value. */
6714 if (initialized) 6722 if (initialized)
6715 { 6723 {
6716 char *release = get_operating_system_release(); 6724 char *release = get_operating_system_release();
6717 if (!release || !release[0] || (release[0] < MIN_PTY_KERNEL_VERSION 6725 if (!release || !release[0] || (release[0] < MIN_PTY_KERNEL_VERSION