unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: BLOCK_INPUT in compile_pattern_1
Date: Mon, 11 Sep 2006 10:11:23 -0400	[thread overview]
Message-ID: <E1GMmVP-0001tV-Kx@fencepost.gnu.org> (raw)
In-Reply-To: <jwv1wqjy2re.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Sun, 10 Sep 2006 14:53:17 -0400)

    I don't have a firm answer, but I suspect that it may have been due to the
    fact that re_compile_pattern may call `malloc'.  And since our
    signal-handling routines can also call `malloc' (unless we use SYNC_INPUT),
    we have to be careful to BLOCK_INPUT around any direct or indirect call
    to malloc.

I think you are right, because I found this comment:

   Here's another reason to avoid allocation: Emacs 
   processes input from X in a signal handler; processing X input may
   call malloc; if input arrives while a matching routine is calling
   malloc, then we're scrod.  But Emacs can't just block input while
   calling matching routines; then we don't notice interrupts when
   they come in.  So, Emacs blocks input around all regexp calls
   except the matching calls, which it leaves unprotected, in the
   faith that they will not malloc.  */

But I think that reason is obsolete.  Nowadays regex.c defines malloc
as a macro to expand into xmalloc, which does BLOCK_INPUT.

So I think that that BLOCK_INPUT call is obsolete,
and that so is MATCH_MAY_ALLOCATE.

Do you think this is correct?

  reply	other threads:[~2006-09-11 14:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-10 18:53 BLOCK_INPUT in compile_pattern_1 Stefan Monnier
2006-09-11 14:11 ` Richard Stallman [this message]
2006-09-11 14:28   ` Stefan Monnier

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=E1GMmVP-0001tV-Kx@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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).