From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Re: why "in_sighandler"? Date: Tue, 22 Aug 2006 16:39:53 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: <87psevdhpc.fsf-monnier+emacs@gnu.org> <44E88FCA.5050705@swipnet.se> <44E9503E.7030609@swipnet.se> <44E95E71.30203@swipnet.se> <44E972EC.8000903@swipnet.se> <44E999CE.3080403@swipnet.se> <44EAA67E.1060400@swipnet.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1156232454 7062 80.91.229.2 (22 Aug 2006 07:40:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 22 Aug 2006 07:40:54 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 22 09:40:50 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 1GFQsA-0000nx-31 for ged-emacs-devel@m.gmane.org; Tue, 22 Aug 2006 09:40:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFQs8-0004dC-HA for ged-emacs-devel@m.gmane.org; Tue, 22 Aug 2006 03:40:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GFQre-0004bk-Df for emacs-devel@gnu.org; Tue, 22 Aug 2006 03:39:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GFQrc-0004ZI-Q3 for emacs-devel@gnu.org; Tue, 22 Aug 2006 03:39:58 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFQrc-0004Z8-LR for emacs-devel@gnu.org; Tue, 22 Aug 2006 03:39:56 -0400 Original-Received: from [133.82.132.2] (helo=mathmail.math.s.chiba-u.ac.jp) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GFQzB-0003z3-0C for emacs-devel@gnu.org; Tue, 22 Aug 2006 03:47:45 -0400 Original-Received: from church.math.s.chiba-u.ac.jp (church [133.82.132.36]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id E91872CB0; Tue, 22 Aug 2006 16:39:53 +0900 (JST) Original-To: Jan =?ISO-8859-1?Q?Dj=E4rv?= In-Reply-To: <44EAA67E.1060400@swipnet.se> User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/22.0.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) 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:58692 Archived-At: >>>>> On Tue, 22 Aug 2006 08:38:54 +0200, Jan Dj=E4rv = said: > How can it be otherwise? If you only have one program counter, that > program counter must be changed to the signal handler no matter how > many threads you have, i.e. any previous execution (regardless of > thread) is interrupted. Not-running threads have already been *interrupted* by context switching. Are they interrupted by a signal again? > When I say interrupted I mean that the signal handling function > starts to run. You obviously mean something else. But this is a > side issue, it has more to do with reentrance of the function > interrupted rather than which thread is currently running. I don't understand why non-signalled threads are relevant as long as a signal handler only executes thread-safe functions. The problem of async-signal-unsafe function is that a thread that took a lock in the normal context may try to take the same lock in a signal handler context. The thread cannot go back to the normal context where the lock will be released afterwards, but just waits for the lock in the signal handler. As a result, the thread gets stuck. That's irrelevant to the other threads. YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp