title: Using signals in a child process
body: <p>I want to create a simple program that uses fork and creates a child process which with the use of pause is waiting. I want this child process to start after it gets a specific signal from father process. Code I've written:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;sys/wait.h&gt;
  #include &lt;unistd.h&gt;
  
  int main() {
      pid_t c = fork();
      if (c == 0) {
          pause();
          printf("signal was given");
      }
      if (c &gt; 0)
          kill(c, SIGINT);
  
      return 0;
  }
  </code></pre>
  
  <p>I think kill gives a specific signal to a process with pid c(child) and I thought that pause just waits for a signal to unpause that process. However in this case running this program has no results. I have also tried adding a signal catching function to the child using <code>signal(SIGINT, handler)</code> and creating a handler function that prints the desired result but it is still not working. Any ideas?</p>