From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Reworked input handling via read_socket_hook interface Date: 03 Mar 2004 15:33:11 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1078442653 2636 80.91.224.253 (4 Mar 2004 23:24:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 4 Mar 2004 23:24:13 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Mar 05 00:24:05 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Az2CD-0004Ob-00 for ; Fri, 05 Mar 2004 00:24:05 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1Az2CD-0004eC-00 for ; Fri, 05 Mar 2004 00:24:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1Az22l-0001N9-A5 for emacs-devel@quimby.gnus.org; Thu, 04 Mar 2004 18:14:19 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1AyWVn-0006gH-BQ for emacs-devel@gnu.org; Wed, 03 Mar 2004 08:34:11 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1AyWVC-0006Vf-RQ for emacs-devel@gnu.org; Wed, 03 Mar 2004 08:34:06 -0500 Original-Received: from [212.88.64.25] (helo=mail-relay.sonofon.dk) by monty-python.gnu.org with smtp (Exim 4.30) id 1AyWVC-0006VR-5r for emacs-devel@gnu.org; Wed, 03 Mar 2004 08:33:34 -0500 Original-Received: (qmail 29524 invoked from network); 3 Mar 2004 13:33:28 -0000 Original-Received: from unknown (HELO kfs-l.imdomain.dk.cua.dk) (213.83.150.2) by 0 with SMTP; 3 Mar 2004 13:33:28 -0000 Original-To: emacs-devel@gnu.org Original-Lines: 43 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:20244 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20244 [Repost -- I sent this to emacs-devel (aka. /dev/null) on Feb. 28] Following my recent changes to read_avail_input that reduced the size of the event buffer, a number of users reported aborts in the read_socket_hook functions on X and W32, as these were not prepared for the input event buffer to overflow. To overcome the problems, I temporarily increased the buffer size. The reason for reducing the size was that profiling had shown that the initialization of the large buffer took a significant amount of CPU cycles. I have now committed more radical changes in the interface to read_socket_hook which I hope will fix this problem permanently. Previously, the caller of read_socket_hook had to allocate a large input_event buffer and initialize it before calling read_socket_hook, and upon return, it had to call kbd_buffer_store_event on each event, stopping after a quit_char event. Now, the read_socket_hook functions use a single local input event to process input, and immediately stores the event into the kbd_buffer fifo via a new kbd_buffer_store_event_hold function. The kbd_buffer_store_event_hold is similar to kbd_buffer_store_event, but it treats quit events differently: - it stores the quit event in a temporary event (via hold_quit arg), - it discards further events stored after the quit event. When read_socket_hook returns, the caller (e.g. read_avail_input) stores the hold_quit event with kbd_buffer_store_event, which again triggers the interrupt_signal. I have modified all of the X, W32, and MAC versions, but I have only tested on X and -nw on GNU/Linux, so there might be problems on W32 and MAC. Please check and report any problems to me. -- Kim F. Storm http://www.cua.dk