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: Mon, 21 Aug 2006 17:13:21 +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> 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 1156148037 5238 80.91.229.2 (21 Aug 2006 08:13:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 21 Aug 2006 08:13:57 +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 10:13:52 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 1GF4ul-0000iV-Pf for ged-emacs-devel@m.gmane.org; Mon, 21 Aug 2006 10:13:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GF4ul-0000GQ-7T for ged-emacs-devel@m.gmane.org; Mon, 21 Aug 2006 04:13:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GF4uU-0000En-FW for emacs-devel@gnu.org; Mon, 21 Aug 2006 04:13:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GF4uT-0000DF-0o for emacs-devel@gnu.org; Mon, 21 Aug 2006 04:13:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GF4uS-0000Cq-9a for emacs-devel@gnu.org; Mon, 21 Aug 2006 04:13:24 -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 1GF51n-0001BI-06 for emacs-devel@gnu.org; Mon, 21 Aug 2006 04:20:59 -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 9AFB72CA0; Mon, 21 Aug 2006 17:13:21 +0900 (JST) Original-To: Jan =?ISO-8859-1?Q?Dj=E4rv?= In-Reply-To: <44E95E71.30203@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:58594 Archived-At: >>>>> On Mon, 21 Aug 2006 09:19:13 +0200, Jan Dj=E4rv = said: > Read the single exception: "when a signal interrupts an unsafe > function and the signal-catching function calls an unsafe function, > the behavior is undefined." So, you interpret that ``what are interrupted by a signal'' are all the functions in execution on the whole threads in the process, not just a single function in execution on the thread that the signal is delivered to? I don't think that is a natural interpretation. > No, but in the presense of signal handlers executing malloc, there > is no scenario that is safe. Your suggestion also has undefined > behaviour accoding to the quote from the standard. As I said earlier, the current Emacs implementation calls malloc within a signal handler with the help of BLOCK_INPUT relying on the assumption that it is safe unless the signal interrupted malloc-related functions. As malloc also internally uses some mutex in order to make it thread-safe, I don't think allowing mutex operations in a signal handler (with the help of BLOCK_INPUT, of course) makes the situation worse. >> Suppose that we abandon emacs_blocked_malloc and so on when >> HAVE_GTK_AND_PTHREAD is defined. I think it is as safe as other >> non-GNU-malloc systems where emacs_blocked_malloc and so on are not >> used, provided that malloc-related functions are thread-safe. What >> do you think about that? > This whole workaround with mutexes and blocks started because Emacs > hanged on some system, I'm not sure if it was a GNU/Linux system or > some kind of BSD variant. So I don't think we should go back, the > old problem happend every time the file selection box was opened on > a Gnome system. Do you mean this one? http://lists.gnu.org/archive/html/emacs-pretest-bug/2004-11/msg00368.html Then it's on a GNU/Linux system and emacs_blocked_malloc has already existed and used, and we've never tried to abandon emacs_blocked_malloc etc. I think BSD variants don't use them by default anyway. YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp