title: Make children process wait until receiving parent's signal
body: <p>I want to create N children from a parent. I want all the children to start (a function - to measure time) at the same time. So I put the function in a signal handler and when the parent finish creating (fork) all children, it sends the signal (using kill(children_id)) to all children to let make start. The code is below but it doesn't work as expected. Specifically, it forked all children but does not execute function "measure_time" at all. This function does not thing but record execution time and print out. 
  Could someone let me know if I am doing something wrong?</p>
  
  <pre><code>    int n_task = 4;
      for (i = 0; i &lt; n_task; i++){
              pid = fork();
              if (pid &lt; 0){
                      printf("cannot fork!\n");
              } else
              if (pid == 0){ //child
                      printf("printed from child [%d]\n", getpid());                        
                      signal(SIGUSR1, measure_time); //measure_time is a function
                      exit(0);
              } else {
                      pid_array[i] = pid;
              }
      }
  
      //This code is executed from parent only
      for (int i = 0; i &lt; n_task; i++)
      {
              kill(pid_array[i], SIGUSR1);                
      }
  </code></pre>