From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Pretest next week Date: Wed, 28 Jan 2009 15:52:25 -0500 Message-ID: <871vunjgqe.fsf@cyd.mit.edu> References: <87y6x4ue2u.fsf@cyd.mit.edu> <87mydjv4bd.fsf@cyd.mit.edu> <08054F25-1F90-4795-9FFE-01363F6900CE@gmail.com> <497E6D32.9000707@gnu.org> <87tz7kawln.fsf@cyd.mit.edu> <4980268C.9020104@gnu.org> <3765D6BE-634B-4D1E-AF8B-7822957F88C7@gmail.com> <6634D95E-39A0-410C-8F28-065D997D5208@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1233175942 1002 80.91.229.12 (28 Jan 2009 20:52:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 Jan 2009 20:52:22 +0000 (UTC) Cc: Adrian Robert , Jason Rumney , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 28 21:53:35 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LSHPc-00059P-Cf for ged-emacs-devel@m.gmane.org; Wed, 28 Jan 2009 21:53:29 +0100 Original-Received: from localhost ([127.0.0.1]:52560 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LSHOK-0002E0-21 for ged-emacs-devel@m.gmane.org; Wed, 28 Jan 2009 15:52:08 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LSHOE-0002Dk-2C for emacs-devel@gnu.org; Wed, 28 Jan 2009 15:52:02 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LSHOC-0002DV-UB for emacs-devel@gnu.org; Wed, 28 Jan 2009 15:52:01 -0500 Original-Received: from [199.232.76.173] (port=34366 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LSHOC-0002DS-ME for emacs-devel@gnu.org; Wed, 28 Jan 2009 15:52:00 -0500 Original-Received: from cyd.mit.edu ([18.115.2.24]:47032) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LSHO8-0007wo-0t; Wed, 28 Jan 2009 15:51:56 -0500 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 9D25057E20A; Wed, 28 Jan 2009 15:52:25 -0500 (EST) In-Reply-To: (Stefan Monnier's message of "Wed, 28 Jan 2009 12:40:12 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:108338 Archived-At: Stefan Monnier writes: > we should probably create a new var `pending_signals', which should > always reflect "pending_timers || interrupt_input_pending", then QUIT > can check this var, and if set, it can call a new function > `process_pending_signals' which will then look at pending_timers and > interrupt_input_pending to figure out which function(s) to call. > > pending_timers and process_pending_timers are desired/needed to reduce > the code-size (the QUIT macro is expanded at many places), as well as to > reduce the polling overhead. So basically any place in the code that sets pending_atimers or interrupt_input_pending would have to set pending_signals as well---something like in the attached patch? It's not clear to me whether we want to process pending atimers in the QUIT macro outside of NS. Do we? *** trunk/src/lisp.h.~1.649.~ 2009-01-28 13:34:25.000000000 -0500 --- trunk/src/lisp.h 2009-01-28 15:46:38.000000000 -0500 *************** *** 1843,1850 **** and (in particular) cannot call arbitrary Lisp code. */ #ifdef SYNC_INPUT ! extern void handle_async_input P_ ((void)); ! extern int interrupt_input_pending; #define QUIT \ do { \ --- 1843,1850 ---- and (in particular) cannot call arbitrary Lisp code. */ #ifdef SYNC_INPUT ! extern void process_pending_signals P_ ((void)); ! extern int pending_signals; #define QUIT \ do { \ *************** *** 1856,1863 **** Fthrow (Vthrow_on_input, Qt); \ Fsignal (Qquit, Qnil); \ } \ ! else if (interrupt_input_pending) \ ! handle_async_input (); \ } while (0) #else /* not SYNC_INPUT */ --- 1856,1863 ---- Fthrow (Vthrow_on_input, Qt); \ Fsignal (Qquit, Qnil); \ } \ ! else if (pending_signals) \ ! process_pending_signals (); \ } while (0) #else /* not SYNC_INPUT */ *** trunk/src/blockinput.h.~1.28.~ 2009-01-28 10:14:34.000000000 -0500 --- trunk/src/blockinput.h 2009-01-28 15:31:45.000000000 -0500 *************** *** 59,64 **** --- 59,69 ---- extern int pending_atimers; + /* This is equal to (interrupt_input_pending || pending_atimers). */ + + extern int pending_signals; + + #if defined (HAVE_NS) && !defined (COCOA_EXPERIMENTAL_CTRL_G) /* NS does not use interrupt-driven input processing (yet), so this is unneeded and moreover was causing problems. */ *** trunk/src/keyboard.c.~1.991.~ 2009-01-26 10:47:17.000000000 -0500 --- trunk/src/keyboard.c 2009-01-28 15:41:13.000000000 -0500 *************** *** 91,96 **** --- 91,98 ---- during the current critical section. */ int interrupt_input_pending; + int pending_signals; + #define KBD_BUFFER_SIZE 4096 KBOARD *initial_kboard; *************** *** 2193,2203 **** struct atimer *timer; { if (poll_suppress_count == 0) #ifdef SYNC_INPUT ! interrupt_input_pending = 1; #else ! poll_for_input_1 (); #endif } #endif /* POLL_FOR_INPUT */ --- 2195,2208 ---- struct atimer *timer; { if (poll_suppress_count == 0) + { #ifdef SYNC_INPUT ! interrupt_input_pending = 1; ! pending_signals = 1; #else ! poll_for_input_1 (); #endif + } } #endif /* POLL_FOR_INPUT */ *************** *** 7261,7266 **** --- 7266,7272 ---- handle_async_input () { interrupt_input_pending = 0; + pending_signals = pending_atimers; while (1) { *************** *** 7274,7279 **** --- 7280,7293 ---- } } + void + process_pending_signals () + { + if (interrupt_input_pending) + handle_async_input (); + do_pending_atimers (); + } + #ifdef SIGIO /* for entire page */ /* Note SIGIO has been undef'd if FIONREAD is missing. */ *************** *** 7291,7296 **** --- 7305,7311 ---- #ifdef SYNC_INPUT interrupt_input_pending = 1; + pending_signals = 1; #else SIGNAL_THREAD_CHECK (signo); #endif *************** *** 11536,11541 **** --- 11551,11557 ---- input_pending = 0; interrupt_input_blocked = 0; interrupt_input_pending = 0; + pending_signals = pending_atimers; /* This means that command_loop_1 won't try to select anything the first time through. */ *** trunk/src/atimer.c.~1.29.~ 2009-01-08 06:46:21.000000000 -0500 --- trunk/src/atimer.c 2009-01-28 15:20:04.000000000 -0500 *************** *** 384,391 **** EMACS_GET_TIME (now); } ! if (! pending_atimers) ! set_alarm (); } --- 384,396 ---- EMACS_GET_TIME (now); } ! if (pending_atimers) ! pending_signals = 1; ! else ! { ! pending_signals = interrupt_input_pending; ! set_alarm (); ! } } *************** *** 397,402 **** --- 402,408 ---- int signo; { pending_atimers = 1; + pending_signals = 1; #ifndef SYNC_INPUT run_timers (); #endif *************** *** 439,444 **** --- 445,451 ---- { free_atimers = atimers = NULL; pending_atimers = 0; + pending_signals = interrupt_input_pending; signal (SIGALRM, alarm_signal_handler); } *** trunk/src/xterm.c.~1.1020.~ 2009-01-16 09:48:32.000000000 -0500 --- trunk/src/xterm.c 2009-01-28 15:23:48.000000000 -0500 *************** *** 7138,7147 **** --- 7138,7149 ---- if (interrupt_input_blocked) { interrupt_input_pending = 1; + pending_signals = 1; return -1; } interrupt_input_pending = 0; + pending_signals = pending_atimers; BLOCK_INPUT; /* So people can tell when we have read the available input. */ *** trunk/src/w32inevt.c.~1.44.~ 2009-01-08 06:46:26.000000000 -0500 --- trunk/src/w32inevt.c 2009-01-28 15:25:12.000000000 -0500 *************** *** 651,660 **** --- 651,662 ---- if (interrupt_input_blocked) { interrupt_input_pending = 1; + pending_signals = 1; return -1; } interrupt_input_pending = 0; + pending_signals = pending_atimers; BLOCK_INPUT; for (;;) *** trunk/src/w32term.c.~1.317.~ 2009-01-10 07:53:18.000000000 -0500 --- trunk/src/w32term.c 2009-01-28 15:24:50.000000000 -0500 *************** *** 4078,4087 **** --- 4078,4089 ---- if (interrupt_input_blocked) { interrupt_input_pending = 1; + pending_signals = 1; return -1; } interrupt_input_pending = 0; + pending_signals = pending_atimers; BLOCK_INPUT; /* So people can tell when we have read the available input. */