Re: exception handling around a signal handler
- From: Rainer Weikusat <rweikusat@xxxxxxxxxxx>
- Date: Tue, 28 Aug 2007 12:02:34 +0200
Ulrich Eckhardt <doomster@xxxxxxxx> writes:
Brilte wrote:
I have some main code that performs work on an object. The object
(technically a struct), represents a child process. Currently i have a
bug within the child process that is causing it to segfault, but thats
not part of my question.
My question really is that when the child segfaults, the parent
receives a sigchld signal. This interrupts the main code which is
working with the child process and moves the object representing the
child process from one linked list into another and i lose the pointer
to the link within the main program causing it to segfault when it
tries to use a NULL pointer.
This can't work.
Of course it can, depending on the actual code being executed. The
signal handler must not use any pointer manipulated by the code it is
interrupting[*] and it must not return to the interrupted code after it
has changed some pointers this code uses to access something only by
reading their contents.
If both are given, the solution is to siglongjmp from the handler to
some place outside the code reading these pointers and that's it.
.
- References:
- exception handling around a signal handler
- From: Brilte
- Re: exception handling around a signal handler
- From: Ulrich Eckhardt
- exception handling around a signal handler
- Prev by Date: Re: exception handling around a signal handler
- Next by Date: Re: exception handling around a signal handler
- Previous by thread: Re: exception handling around a signal handler
- Next by thread: Re: exception handling around a signal handler
- Index(es):
Relevant Pages
|
|