unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: why "in_sighandler"?
Date: Mon, 21 Aug 2006 17:13:21 +0900	[thread overview]
Message-ID: <wl3bbqqzfi.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <44E95E71.30203@swipnet.se>

>>>>> On Mon, 21 Aug 2006 09:19:13 +0200, Jan Djärv <jan.h.d@swipnet.se> 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

  reply	other threads:[~2006-08-21  8:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-20  6:51 why "in_sighandler"? Stefan Monnier
2006-08-20 16:37 ` Jan D.
2006-08-20 18:22   ` Stefan Monnier
2006-08-21  0:08   ` YAMAMOTO Mitsuharu
2006-08-21  6:18     ` Jan Djärv
2006-08-21  6:44       ` YAMAMOTO Mitsuharu
2006-08-21  7:19         ` Jan Djärv
2006-08-21  8:13           ` YAMAMOTO Mitsuharu [this message]
2006-08-21  8:46             ` Jan Djärv
2006-08-21  8:58               ` YAMAMOTO Mitsuharu
2006-08-21 11:32                 ` Jan Djärv
2006-08-22  0:22                   ` YAMAMOTO Mitsuharu
2006-08-22  6:38                     ` Jan Djärv
2006-08-22  7:39                       ` YAMAMOTO Mitsuharu
2006-08-22  8:23                         ` Jan Djärv
2006-08-22  8:34                           ` YAMAMOTO Mitsuharu
2006-08-22 18:00                             ` Jan Djärv
2006-08-22  9:43                           ` Andreas Schwab
2006-08-21 11:13   ` Richard Stallman
2006-08-21 12:55     ` Jan Djärv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=wl3bbqqzfi.wl%mituharu@math.s.chiba-u.ac.jp \
    --to=mituharu@math.s.chiba-u.ac.jp \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).