title: Linux C comunication beetween processes using signals and pipes
body: <p>I have a program to write in C. It must create 3 processes which work all time. Those 3 processes receive signals(stop, pause, resume), when it receive one of those signals it sends other signal to the rest of processes and then writes to pipe(it must be pipe) what signal he receive. The others receive that signal and read the pipe and do what is said in pipe. 
  I have something like that to write a pipe in signal handler:</p>
  
  <pre><code>void rcvkillsig(int sig){
    if(sig==SIGINT){
      int op;
      op = 1;
      close(pfd1[0]);
      close(pfd3[0]);
      write(pfd1[1], &amp;op, 8);
      write(pfd3[1], &amp;op, 8);
      close(pfd1[1]);
      close(pfd3[1]);
      kill(sndpid, SIGCONT);
      kill(rcvpid, SIGCONT);
      printf("End chk\n");
      kill(chkpid, SIGKILL);
    }
  }
  </code></pre>
  
  <p>And something like that to read pipe:</p>
  
  <pre><code>void rcvinfsig(int sig){        
    if(sig==SIGCONT){
      cflag=0;
      int op;
      close(pfd2[1]);
      read(pfd2[0], &amp;op, 8);
      close(pfd2[0]);
      if(op==1){
          kill(chkpid, SIGKILL);
          printf("End chk\n");
      }
      else if(op==2){
          printf("Pause chk!\n");
          cpaused=1;
      }
      else if(op==3){
          printf("Resume chk!\n");
          cpaused=0;
      }
    }
  }
  </code></pre>
  
  <p>Of course there are codes like that for every process, and received signal.</p>
  
  <p>I use in this program pfd1[2], pfd2[2], pfd3[2] for each process and in main function creates pipes for them by pipe(...). </p>
  
  <p>My problem is that, when the process receive first signal(for example pause) he write to a pipe, but when it receives second signal(for example resume) it don't write to pipe, and resumes only self.</p>
  
  <p>Please help I need that program on Monday. The rest of code works and I don't have only that communication.</p>