| | |
A question about signal
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
This code is just handling the SIGCHLD signal, but as you can see, the parent process should ignore this SIGCHLD signal according to the signal function. But in fact, the parent process will omit the signal function, and handling the child process using "wait". I wonder why the parent do not ignore the SIGCHLD signal?
1int main(argc,argv) { 2 int argc; 3 char *argv[] int i,ret_val,ret_code; 4 if(argc>1) 5 signal(SIGCLD,SIG_IGN); 6 for(i=0;i<10;i++) 7 if(fork()==0) { 8 printf("child proc %x\n",getpid()); 9 exit(i); 10 } 11 ret_val=wait(&ret_code); 12 }
Similar Threads
- ValueError: signal only works in main thread. HUH? It's worked before. (Python)
- Scientific Computing with C# , data visualization and plotting (C#)
- vga--no input signal? (Monitors, Displays and Video Cards)
- Signal strength vs throughput speed question (Networking Hardware Configuration)
- Monitor: NO SIGNAL, when connected to motherboard video slot (Monitors, Displays and Video Cards)
- Airport Express Question (Networking Hardware Configuration)
- "input signal out of range" at startup (Windows NT / 2000 / XP)
- Trying to find a way to boost my friends wireless connection (Networking Hardware Configuration)
- Laptop LCD built into a car? (Monitors, Displays and Video Cards)
| Thread Tools | Search this Thread |
Tag cloud for C
#include * append array arrays asterisks binarysearch calculate changingto char character cm command copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic execv feet fgets file fork forloop framework function functions givemetehcodez grade graphics gtkwinlinux hacking histogram homework inches include incrementoperators input intmain() iso kernel keyboard km lazy license linked linkedlist linux list lists locate logical_drives looping loopinsideloop. lowest matrix microsoft mqqueue number oddnumber odf opendocumentformat opensource overwrite owf pdf performance pointer posix problem probleminc process program programming radix recursion recv recvblocked research reversing scanf scripting segmentationfault sequential socket spoonfeeding standard string student systemcall testing threads turboc unix user variable wab whythiscodecausesegmentationfault windowsapi



