[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why "in_sighandler"?

From: Jan Djärv
Subject: Re: why "in_sighandler"?
Date: Mon, 21 Aug 2006 10:46:36 +0200
User-agent: Thunderbird (X11/20060808)

YAMAMOTO Mitsuharu skrev:
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.

I don't see the line "what are interrupted by a signal" in the quote, so I'm not sure what you mean.

My interpretation is that it is unsafe to call lock/unlock from a thread and from a signal handler at the same time, if they operate on the same mutex. That is what the original hang was all about.

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.

But this only works for the Emacs main thread, not the Gnome threads.

        Jan D.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]