[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: BLOCK_INPUT in compile_pattern_1
From: |
Stefan Monnier |
Subject: |
Re: BLOCK_INPUT in compile_pattern_1 |
Date: |
Mon, 11 Sep 2006 10:28:22 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> 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?
I guess so, although to tell you the truth, avoiding such brittle
reasoning (And code) was one of the motivations for my SYNC_INPUT patch, so
now that I've implemented this patch I prefer not to think too much about
what could happen in this or that corner case when SYNC_INPUT is
not used.
Stefan