Page 1 of 1

Signals, and forking

Posted: Tue Mar 25, 2008 4:01 pm
by piranha
Quick question:
I have signals. When a task forks, should the parent task's signals be copied to the child task's signal list?

-JL

Posted: Wed Mar 26, 2008 12:58 am
by bewing
I'll assume that you have another mechanism for multithreading, so you are only referring to independent child processes.

I would say that a traditionally defined fork() function should copy the signal table, and then exec() should obviously reset the table to defaults. The thing is, UNIX/POSIX was pretty adamant that fork() should produce an absolutely 100% exact perfect copy. No way whatsoever to tell the difference between the two, except for the return value from fork().

Posted: Wed Mar 26, 2008 6:27 am
by nick8325
According to http://www.opengroup.org/onlinepubs/000 ... /fork.html, the child task should keep the parent's signal handlers but not its pending signals.

Posted: Wed Mar 26, 2008 1:38 pm
by piranha
Thanks, implemented. File descriptors too, eh? Hmm....I guess i'll do that too.

-JL