title: pthread_kill() not sending signal to main thread (main program)
body: <p>signal can be received in any threads or main program itself.
  i have created one auxiliary thread from main program. so there is two thread in my program 1. main thread (process itself) 2. Auxiliary Thread. I just want that whenever signal arrived in my auxiliary thread, that should send signal to my main thread (program). i am using pthread_kill(main_threadid, sig) to send signal from signal handler register inside auxiliary thread. but. i observe each time signal send to main thread received to auxiliary child itself and signal handler falls in loop of receiving sending signal. </p>
  
  <pre><code>#include &lt;pthread.h&gt;
  #include &lt;signal.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;unistd.h&gt;
  
  // global variable
  pthread_t main_threadId;
  struct sigaction childpsa;
  
  // Signal Handler for Auxiliary Thread  
  void signalHandler_Child(int param)
  {
      printf("Caught signal: %d in auxiliary Thread", param);
      pthread_kill(main_threadId, param);
  }
  
  void *childFun(void *arg)
  {
      childpsa.sa_handler = signalHandler_Child;
      sigaction(SIGTERM, &amp;childpsa, NULL);
      sigaction(SIGHUP, &amp;childpsa, NULL);
      sigaction(SIGINT, &amp;childpsa, NULL);
      sigaction(SIGCONT, &amp;childpsa, NULL);
      sigaction(SIGTSTP, &amp;childpsa, NULL);
  
      while (1) {
          // doSomething in while loop
      }
  }
  
  int main(void)
  {
      main_threadId = pthread_self();
  
      fprintf(stderr, "pid to signal %d\n", getpid());
  
      // create a auxiliary thread here
      pthread_t child_threadId;
      int err = pthread_create(&amp;child_threadId, NULL, &amp;childFun, NULL);
  
      while (1) {
          // main program do something 
      }
  
      return 1;
  }
  </code></pre>
  
  <p>say I am sending SIGINT to process from terminal using its process id.</p>