title: sigwait() does not work in multithreaded program
body: <p>I'm trying to write a multithreaded program which one thread (variable thread in below) is responsible to any asynchronous signals that might be set to this process.</p>
  
  <p>I am facing thread that uses sigwait() but does not react to any signals have been sent to process. (like SIGUSR1 in below).</p>
  
  <pre><code>static void * signal_thread(void *arg = nullptr)
  {
      int sig = -1;
      sigset_t sigset;
      sigfillset(&amp;sigset);
      pthread_sigmask(SIG_BLOCK, &amp;sigset, NULL);
      while(1)
      {
         int s = sigwait(&amp;sigset, &amp;sig);
         if(s == 0)
            printf("SIG %d recieved!...\n", sig);
         usleep(20);
      }
  }
  
  int main()
  {
      sigset_t signalset;
      pthread_t thread;
      pthread_create(&amp;thread, NULL, &amp;signal_thread, nullptr);
      sigfillset(&amp;signalset);
      pthread_sigmask(SIG_BLOCK, &amp;signalset, NULL);
  
      while(1)
      {
         raise(SIGUSR1);
         usleep(20);
      }
  }
  </code></pre>