From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Jan D." Newsgroups: gmane.emacs.devel Subject: Re: Core dumps in redisplay. Date: Sun, 27 Feb 2005 21:35:13 +0100 Message-ID: <7eee8e4a0b7241b67a0ae97e4923b908@swipnet.se> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v619.2) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1109536721 29357 80.91.229.2 (27 Feb 2005 20:38:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 27 Feb 2005 20:38:41 +0000 (UTC) Cc: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 27 21:38:40 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D5VBS-0005P9-RJ for ged-emacs-devel@m.gmane.org; Sun, 27 Feb 2005 21:38:35 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D5VTg-0004w2-Iz for ged-emacs-devel@m.gmane.org; Sun, 27 Feb 2005 15:57:24 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D5VPL-0002Z6-47 for emacs-devel@gnu.org; Sun, 27 Feb 2005 15:52:55 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D5VPA-0002Py-QY for emacs-devel@gnu.org; Sun, 27 Feb 2005 15:52:45 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D5VP7-0002IH-Um for emacs-devel@gnu.org; Sun, 27 Feb 2005 15:52:42 -0500 Original-Received: from [195.54.107.73] (helo=mxfep02.bredband.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D5V8b-0008Nq-4o; Sun, 27 Feb 2005 15:35:37 -0500 Original-Received: from coolsville.localdomain ([83.226.180.210] [83.226.180.210]) by mxfep02.bredband.com with ESMTP id <20050227203536.UDRN17521.mxfep02.bredband.com@coolsville.localdomain>; Sun, 27 Feb 2005 21:35:36 +0100 In-Reply-To: Original-To: David Kastrup X-Mailer: Apple Mail (2.619.2) 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 X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: main.gmane.org gmane.emacs.devel:33879 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:33879 > "Jan D." writes: > >>> Also with regard to the other report you answered (where I was >>> wrong): >>> I might well be mistaken. I am just trying to get a hold of why >>> Emacs >>> keeps crashing on me. It appears, anyway, that something seriously >>> elusive is going on here. I'll probably have to implement some kind >>> of trace buffering for interrupt_input_block in order to get a hold >>> of >>> what is happening here. >>> >>> I already disassembled stuff because I thought the compiler might be >>> at fault. Maybe I should also try without optimization. >> >> >> If you configured with GTK, there is a possibility that multiple >> threads are updating interrupt_input_block. I've tried to handle that >> situation, but bugs may of course still remain. > > How did you try to handle it? Basically, we have the following > accesses to interrupt_input_blocked: > > BLOCK_INPUT increases it > UNBLOCK_INPUT decreases it > TOTALLY_UNBLOCK_INPUT resets it > throws reset it to the state at the time of the catch > > The last two options would behave really badly in the presence of > multithreading. > > There must only be one thread touching interrupt_input_blocked, or we > get into trouble. I don't see that we can sensibly handle the case > "reset to state at the time of the catch" in any manner with two > threads accessing the variable. We need one variable per thread then, > and the input is blocked if either variable is nonzero. Only a > per-thread variable can be reset to a meaningful value. > > Could you elaborate on what happens here in parallel threads? I can't > imagine that one can execute Lisp sanely in two threads, so one thread > would be likely C-only? Why would that thread have to meddle with > interrupt_input_blocked at all? The GTK file dialog can load different backends (Gnome has one) that may add or alter the behaviour of the file dialog. The Gnome backend creates several threads (the default GTK backend does not). This is not a problem, except when a signal (i.e. real Unix signal) is caught by Emacs. The signal may be caught by one of the Gnome threads and it would then execute the X event loop. This situation leads to two threads accessing variables and a crash usually occurs (perhaps a bit later). The fix is basically to keep track of what thread id the Emacs main thread has, and if a signal handler is called by another thread id, the signal is delivered to the main thread and nothing more is done in the signal handler. The goal is to get only the main thread to execute "Emacs" code, and keep the Gnome threads from interferring. Jan D.