From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Jan_Dj=E4rv?= Newsgroups: gmane.emacs.devel Subject: Re: why "in_sighandler"? Date: Mon, 21 Aug 2006 08:18:38 +0200 Message-ID: <44E9503E.7030609@swipnet.se> References: <87psevdhpc.fsf-monnier+emacs@gnu.org> <44E88FCA.5050705@swipnet.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1156141187 19693 80.91.229.2 (21 Aug 2006 06:19:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 21 Aug 2006 06:19:47 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 21 08:19:42 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GF38L-00042c-7k for ged-emacs-devel@m.gmane.org; Mon, 21 Aug 2006 08:19:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GF38K-00010h-Kd for ged-emacs-devel@m.gmane.org; Mon, 21 Aug 2006 02:19:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GF388-0000zD-0J for emacs-devel@gnu.org; Mon, 21 Aug 2006 02:19:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GF384-0000xM-8k for emacs-devel@gnu.org; Mon, 21 Aug 2006 02:19:22 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GF383-0000wy-Me for emacs-devel@gnu.org; Mon, 21 Aug 2006 02:19:19 -0400 Original-Received: from [81.228.9.182] (helo=av7-2-sn3.vrr.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GF3FN-0002w9-O1 for emacs-devel@gnu.org; Mon, 21 Aug 2006 02:26:53 -0400 Original-Received: by av7-2-sn3.vrr.skanova.net (Postfix, from userid 502) id B938438262; Mon, 21 Aug 2006 08:19:13 +0200 (CEST) Original-Received: from smtp3-1-sn3.vrr.skanova.net (smtp3-1-sn3.vrr.skanova.net [81.228.9.101]) by av7-2-sn3.vrr.skanova.net (Postfix) with ESMTP id AB30938249; Mon, 21 Aug 2006 08:19:13 +0200 (CEST) Original-Received: from coolsville.localdomain (81-235-205-204-no59.tbcn.telia.com [81.235.205.204]) by smtp3-1-sn3.vrr.skanova.net (Postfix) with ESMTP id 24E6A37E46; Mon, 21 Aug 2006 08:19:15 +0200 (CEST) User-Agent: Thunderbird 1.5.0.5 (X11/20060808) Original-To: YAMAMOTO Mitsuharu In-Reply-To: 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:58589 Archived-At: YAMAMOTO Mitsuharu skrev: >>>>>> On Sun, 20 Aug 2006 18:37:30 +0200, "Jan D." said: > >> I needed a variable that was only set when the signal handler is >> running. > > I've got no response from you to my last message (*1) in the related > thread. So I'm not sure if you are for or against my suggestion about > undoing `in_sighandler'-related changes and just changing the order of > lock/unlock and BLOCK_INPUT/UNBLOCK_INPUT in the previous version of > BLOCK_INPUT_ALLOC/UNBLOCK_INPUT_ALLOC as follows. > > #define BLOCK_INPUT_ALLOC \ > do \ > { \ > if (pthread_self () == main_thread) \ > BLOCK_INPUT; \ > pthread_mutex_lock (&alloc_mutex); \ > } \ > while (0) > #define UNBLOCK_INPUT_ALLOC \ > do \ > { \ > pthread_mutex_unlock (&alloc_mutex); \ > if (pthread_self () == main_thread) \ > UNBLOCK_INPUT; \ > } \ > while (0) > I don't like it, because it assumes things are "probably OK" to run in the signal handler (i.e. pthread_mutex_lock/unlock). I still think it might hang if a Gnome thread is in mutex_lock and a signal arrives and then the signal handler also enters mutex_lock. It is one assumtion against another, neither suggestion is without flaws (we need SYNC_INPUT for that). Jan D.