Re: [LAD] Session Handlers and 'level 1' support

From: Chris Cannam <cannam@email-addr-hidden-day-breakfast.com>
Date: Fri Jan 08 2010 - 16:16:49 EET

On Fri, Jan 8, 2010 at 2:06 PM, Gabriel M. Beddingfield
<gabrbedd@email-addr-hidden> wrote:
> On Fri, 8 Jan 2010, Chris Cannam wrote:
>>
>> This is far too weak -- it _cannot_ safely be done from a signal handler.
>
> Why not?

A signal handler can be called at any time, so can't safely interact
with its environment (even with the heap) in any meaningful way.

e.g. C99:

"If the signal occurs other than as the result of calling the abort or
raise function, the
behavior is undefined if the signal handler refers to any object with
static storage duration
other than by assigning a value to an object declared as volatile
sig_atomic_t, or
the signal handler calls any function in the standard library other
than the abort
function, the _Exit function, or the signal function with the first
argument equal to
the signal number corresponding to the signal that caused the
invocation of the handler."

So the only thing you're allowed to do, besides exit, is assign to a
global volatile sig_atomic_t variable and return.

Realistically you may be able to get away with more than that, but
saving a document is definitely out.

Chris
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Fri Jan 8 16:15:05 2010

This archive was generated by hypermail 2.1.8 : Fri Jan 08 2010 - 16:15:06 EET