>>251
> 1. longjmp( )は、シグナルハンドラからの使用を考慮されている、
> あるいは使用例としてよく出てくるんですが
> 実際、シグナルハンドラからのlongjmp( )は安全ですか?
ttp://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html
より引用。
> In the presence of signals, all functions defined by this volume of
> IEEE Std 1003.1-2001 shall behave as defined when called from or
> interrupted by a signal-catching function, with a single exception:
> when a signal interrupts an unsafe function and the signal-catching
> function calls an unsafe function, the behavior is undefined.

で、malloc()もlongjmp()もsiglongjmp()もsignal unsafe。
よって、「malloc()中にシグナル発生 → シグナルハンドラ内でlongjmp()
(またはsiglongjmp())呼び出し」となった場合の動作は「undefined」。
実際にglibcのソースを眺めてみたが、シグナルに対して特別なことをやっては
いないみたいだから、メモリリークやデッドロックが発生する可能性があるな。

> 2. シグナルハンドラとそうでない部分との排他制御は
> そうでない部分で、シグナルをマスクするだけで十分ですか?
OK.

> 3. シグナルハンドラが実行されているさいちゅうに
> 多重に呼び出されることはありますか?
ここらへんについては、BSD由来のsignal()とSysV由来のsignal()とで
挙動が大きく違っていたが、新しいシグナル操作関数であるsigaction()では
そこら辺の混乱が解消されている。
ttp://www.opengroup.org/onlinepubs/009695399/functions/sigaction.html
SA_NODEFERの項を見よ。