[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: why "in_sighandler"?
From: |
YAMAMOTO Mitsuharu |
Subject: |
Re: why "in_sighandler"? |
Date: |
Mon, 21 Aug 2006 17:13:21 +0900 |
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) |
>>>>> On Mon, 21 Aug 2006 09:19:13 +0200, Jan Djärv <address@hidden> 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
address@hidden
- why "in_sighandler"?, Stefan Monnier, 2006/08/20
- Re: why "in_sighandler"?, Jan D., 2006/08/20
- Re: why "in_sighandler"?, Stefan Monnier, 2006/08/20
- Re: why "in_sighandler"?, YAMAMOTO Mitsuharu, 2006/08/20
- Re: why "in_sighandler"?, Jan Djärv, 2006/08/21
- Re: why "in_sighandler"?, YAMAMOTO Mitsuharu, 2006/08/21
- Re: why "in_sighandler"?, Jan Djärv, 2006/08/21
- Re: why "in_sighandler"?,
YAMAMOTO Mitsuharu <=
- Re: why "in_sighandler"?, Jan Djärv, 2006/08/21
- Re: why "in_sighandler"?, YAMAMOTO Mitsuharu, 2006/08/21
- Re: why "in_sighandler"?, Jan Djärv, 2006/08/21
- Re: why "in_sighandler"?, YAMAMOTO Mitsuharu, 2006/08/21
- Re: why "in_sighandler"?, Jan Djärv, 2006/08/22
- Re: why "in_sighandler"?, YAMAMOTO Mitsuharu, 2006/08/22
- Re: why "in_sighandler"?, Jan Djärv, 2006/08/22
- Re: why "in_sighandler"?, YAMAMOTO Mitsuharu, 2006/08/22
- Re: why "in_sighandler"?, Jan Djärv, 2006/08/22
- Re: why "in_sighandler"?, Andreas Schwab, 2006/08/22