![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| signal handling question | fox_hound_33 | High Level Programming | 7 | 05-31-2008 10:53 AM |
| Signal handling in Perl | obelix | Shell Programming and Scripting | 6 | 12-19-2007 08:08 PM |
| signal handling in shell script | Raom | UNIX for Advanced & Expert Users | 4 | 12-08-2005 02:55 AM |
| Handling SIGUSR2 signal | diganta | UNIX for Advanced & Expert Users | 3 | 11-21-2005 07:18 AM |
| Sun Sol 5.1 Signal Values | Texan_BOB | SUN Solaris | 3 | 09-11-2003 01:55 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Signal Handling
Hi folks
I'm trying to write a signal handler (in c on HPUX) that will catch the child process launched by execl when it's finished so that I can check a compliance file. The signal handler appears to catch the child process terminating however when the signal handler completes the parent process crashes and restarts. Please can anyone give me any advice as to what I'm doing wrong. // main signal(SIGCHLD, TerminateChild); int pid = fork(); // if pid O.K execl(params); // launch a seperate Java process // end main void TerminateChild(int sig) { int pid, status; pid = waitpid(-1, &status, WNOHANG); // Check a file for a compliance // send IPC message signal(SIGCHLD, TerminateChild); } |
| Forum Sponsor | ||
|
|
|
|||
|
Is there a reason you cannot call waitpid() -- or wait()?
Signals arrive asynchronously, so you parent process' code could be in any state when the signal arrives..... but if you do stuff, then call wait() you're at a known point. |