Re: Can fork be used in a signal handler?
- From: Rainer Weikusat <rweikusat@xxxxxxxxxxx>
- Date: Fri, 28 Mar 2008 15:04:37 +0100
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?
Assuming there are no 'other issues' (ie 'multiple threads'), yes.
I would nevertheless rather do the fork outside the signal handler.
I know that non-reentrant functions can not be
used inside a signal handler.
This is wrong. A signal handler must only call functions which are
async-signal-safe (that's different from 'reentrant') if the signal
could have interrupted a non async-signal-safe function. A list of
those is given in the 'Signal Concepts' section of SUS.
And in the signal handler i'm traversing a linked list which has the
complexity of O(n2).
Traversing a linked-list is an operation with a linear complexity
(O(n)).
.
- References:
- Can fork be used in a signal handler?
- From: kiran
- Can fork be used in a signal handler?
- Prev by Date: 64-bit c++ application crashing on solaris
- Next by Date: Re: Interpreting program core dump in mdb
- Previous by thread: Can fork be used in a signal handler?
- Next by thread: Re: Can fork be used in a signal handler?
- Index(es):
Relevant Pages
|