Syncing Processes 2

Process Synchronization method 2
 /* proc_syncV2 */  
 // header files  
 #include<unistd.h>  
 #include<stdio.h>  
 int main()  
 {  
      int i,pid,exitstat,status;  
      pid=fork();  
      if(pid==0)  
      {  
       sleep(10);  
       exit(3);  
      }  
      else  
      {  
           wait(&status);  
           printf("status returned by the process is %d\n",status);  
           printf("status & 0xff = %d\n",status&0xff);  
           if(status&0xff!=0)  
           {  
                printf("signal is interrupted\n");  
           }  
           else  
           {  
                exitstat=(int)status/256;  
                printf("Exit status from %d was %d\n",pid,exitstat);  
           }  
      }  
      return 0;  
 }  

Comments

Popular posts from this blog

Setting up atalanta ATPG to work on Linux

Generating 16k ROM using Xilinx IP COREGEN and simulating it in modelsim

Sparse matrix - 3 tuple representation