Re: Can fork be used in a signal handler?
- From: Casper H.S. *** <Casper.***@xxxxxxx>
- Date: 28 Mar 2008 14:25:39 GMT
kiran <edu.mvk@xxxxxxxxx> writes:
I have a problem that i have to create a new process, when my process
gets a SIGCHLD.
So i want to use fork inside the signal handler for SIGCHLD.
Can i use like that? I know that non-reentrant functions can not be
used inside a signal handler. Is fork() a reentrant function or not?
And in the signal handler i'm traversing a linked list which has the
complexity of O(n2). Is that ok if a signal handler to be that heavy?
Note: no global variables are being changed inside the handler.
How do you guarantee that the linked list is in a stable state in the
signal handler?
fork() can legally be called from signal handlers (per POSIX).
See http://www.unix.org/single_unix_specification/
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
.
- References:
- Can fork be used in a signal handler?
- From: kiran
- Can fork be used in a signal handler?
- Prev by Date: Re: Interpreting program core dump in mdb
- Next by Date: Re: 64-bit c++ application crashing on solaris
- Previous by thread: Re: Can fork be used in a signal handler?
- Next by thread: Re: Can fork be used in a signal handler?
- Index(es):