| | |
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 bash binarysearch changingto char character cm command copyanyfile copypdffile createprocess() database directory drawing dynamic execv feet fgets file floatingpointvalidation fork framework function functions getlogicaldrivestrin givemetehcodez global grade graphics gtkwinlinux histogram homework i/o ide include infiniteloop initialization input interest intmain() iso keyboard kilometer lazy license linked linkedlist linux list looping loopinsideloop. lowest matrix meter microsoft mqqueue oddnumber odf open openwebfoundation overwrite pause pdf pointer pointers posix power process program programming pyramidusingturboccodes read recursion recv recvblocked reversing segmentationfault single socket socketprogramming spoonfeeding standard strchr string student suggestions system test testing threads unix urboc user whythiscodecausesegmentationfault win32api windowsapi



