From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan =?UTF-8?Q?Dj=C3=A4rv?= Newsgroups: gmane.emacs.bugs Subject: bug#9216: Signal handling and pthreads Date: Tue, 02 Aug 2011 10:11:55 +0200 Message-ID: <4E37B14B.7000803@swipnet.se> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1312272766 13969 80.91.229.12 (2 Aug 2011 08:12:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 2 Aug 2011 08:12:46 +0000 (UTC) Cc: 9216@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 02 10:12:42 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QoA5g-0001Wa-0I for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Aug 2011 10:12:40 +0200 Original-Received: from localhost ([::1]:38391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoA5f-0001yk-Hi for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Aug 2011 04:12:39 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:47289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoA5c-0001yQ-IU for bug-gnu-emacs@gnu.org; Tue, 02 Aug 2011 04:12:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QoA5b-0007OR-AZ for bug-gnu-emacs@gnu.org; Tue, 02 Aug 2011 04:12:36 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43186) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoA5b-0007OJ-8K for bug-gnu-emacs@gnu.org; Tue, 02 Aug 2011 04:12:35 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QoA61-0006tq-O2; Tue, 02 Aug 2011 04:13:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jan =?UTF-8?Q?Dj=C3=A4rv?= Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Aug 2011 08:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9216 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9216-submit@debbugs.gnu.org id=B9216.131227274626481 (code B ref 9216); Tue, 02 Aug 2011 08:13:01 +0000 Original-Received: (at 9216) by debbugs.gnu.org; 2 Aug 2011 08:12:26 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QoA5S-0006t4-Cz for submit@debbugs.gnu.org; Tue, 02 Aug 2011 04:12:26 -0400 Original-Received: from smtprelay-b11.telenor.se ([62.127.194.20]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QoA5Q-0006sw-5M for 9216@debbugs.gnu.org; Tue, 02 Aug 2011 04:12:25 -0400 Original-Received: from ipb2.telenor.se (ipb2.telenor.se [195.54.127.165]) by smtprelay-b11.telenor.se (Postfix) with ESMTP id 72EFDEA5E6 for <9216@debbugs.gnu.org>; Tue, 2 Aug 2011 10:11:56 +0200 (CEST) X-SENDER-IP: [85.225.45.26] X-LISTENER: [smtp.bredband.net] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuNmAHCwN05V4S0aPGdsb2JhbABCiQ6eUAsBAQEBHhkNJYFAAQEEATgeIgEQCyEWDwkDAgECARsMChQGDQEHAQGHaALBIIZCBJgCi18 X-IronPort-AV: E=Sophos;i="4.67,305,1309730400"; d="scan'208";a="209671962" Original-Received: from c-1a2de155.25-1-64736c10.cust.bredbandsbolaget.se (HELO coolsville.localdomain) ([85.225.45.26]) by ipb2.telenor.se with ESMTP; 02 Aug 2011 10:11:56 +0200 Original-Received: from [172.20.199.13] (zeplin [172.20.199.13]) by coolsville.localdomain (Postfix) with ESMTPSA id 725897FA059; Tue, 2 Aug 2011 10:11:55 +0200 (CEST) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:5.0) Gecko/20110624 Thunderbird/5.0 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 02 Aug 2011 04:13:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:49795 Archived-At: Hi. Stefan Monnier skrev 2011-08-01 19:44: > In syssignal.h we have: > > #if defined (HAVE_GTK_AND_PTHREAD) || defined (HAVE_NS) > #include > /* If defined, asynchronous signals delivered to a non-main thread are > forwarded to the main thread. */ > #define FORWARD_SIGNAL_TO_MAIN_THREAD > #endif > > But that is not right: the test should bot be for HAVE_NS and HAVE_GTK, > but just for using pthreads. There are more ways to get > pthreads involved. At first, only GTK could start different threads in Emacs. But this has changed now, with Dbus and others. The usage of threads within libraries is an internal matter, so I think Emacs should be prepared for threads always when is available. This will become more important if runtime linking of libraries introduces threads in Emacs. So Emacs should use pthread always where available, just to be prepared. > > IOW we should also set FORWARD_SIGNAL_TO_MAIN_THREAD when using > libdconfsettings (and maybe some more). Tho a better fix might be to > better set up our signal handlers so we don't need this > SIGNAL_THREAD_CHECK hack which seems unreliable (it drops signals on > the floor when delivered to the wrong thread, which would seem to mean > the main thread may fail to be told about pending input to be processed). > Are you thinking of sigwait? Other than sigwait, there is no way to "set up our signal handlers so we don't need this", where this == SIGNAL_THREAD_CHECK. SIGNAL_THREAD_CHECK is not unreliable. It does not drop signals delivered to the wrong thread, it forwards them to the main thread. Jan D.