aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/process.c b/src/process.c
index 34966d35160..d60fe1e3bf6 100644
--- a/src/process.c
+++ b/src/process.c
@@ -272,17 +272,19 @@ int update_tick;
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
277static int process_output_delay_count; 278static 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
281static int process_output_skip; 282static 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. */
286static Lisp_Object Vprocess_adaptive_read_buffering; 288static Lisp_Object Vprocess_adaptive_read_buffering;
287#else 289#else
288#define process_output_delay_count 0 290#define process_output_delay_count 0
@@ -1536,7 +1538,6 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
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;
@@ -4320,6 +4321,11 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
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);
@@ -4330,6 +4336,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
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--;
@@ -4880,10 +4888,10 @@ read_process_output (proc, channel)
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,
@@ -4939,7 +4947,7 @@ read_process_output (proc, channel)
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. */
@@ -6338,10 +6346,10 @@ exec_sentinel (proc, reason)
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,
@@ -6355,7 +6363,7 @@ exec_sentinel (proc, reason)
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;
@@ -6709,7 +6717,7 @@ init_process ()
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 {