title: Linux child process signal loss
body: <p>I have two child processes and one parent process. The two child send a SIGUSR1 signal at the same time. The handler handles only one of them, and the parent receives only one of them too. I think it can be solved by using real time signal, but i don't now how to do it. Thank you for your help. </p>
  
  <pre><code>void handler(int signalnumber)
  {
     //do stuff
  }
  int main()
  {
     sigset_t blockset;
     sigfillset(&amp;blockset);
  
     struct sigaction action;
     action.sa_handler = handler;
     sigemptyset(&amp;action.sa_mask);
     sigaction(SIGUSR1, &amp;action, NULL);
  
     pid_t pid = getpid();
     pid_t pids[2];
  
     for(i = 0; i &lt; 2; ++i)
     {
        if(getpid() == pid)
           pids[i] = fork();
     }
  
     if(getpid() != pid)
     {
         while(1)
         {
             kill(getppid(), SIGUSR1);
         }
     } else
     {
        while(1)
        {
            sigdelset(&amp;blockset, SIGUSR1);
            sigsuspend(&amp;blockset);
            //do stuff
        }
     }
  }
  </code></pre>
  
  <p>Edit: I replaced SIGUSR1 with SIGRTMIN+1. Now the handler receives both signals, but the parent does not. (I think, because it's not waiting for any.)</p>