title: C - Use sigsuspend in a thread doesn't work
body: <p>for a homework assignment I have to use only <code>linux</code> system calls to manage signals in a game, programmed in <code>C</code>.
  One thing I have to do, it's to call indefinitly sigsuspend in a <code>thread</code> and wait for a <code>SIGALRM</code>,then if there is a sigalarm (signal alarm) I have to <code>printf()</code> something (doesn't matter what). </p>
  
  <p>However, I tried several things but it doesn't work, I don't know how to <code>"deblock"</code> sigsuspend and print what  i want. And there is a timer in the game which send sigalrm. My code works but not the part with the <code>sigsuspend</code>
  Of course I have also a <code>sigarlm</code> handler which does some stuff with <code>SDL</code> when it receives a <code>sigarlm</code>.
  I don't really how I have to use masks with <code>sigsuspend</code></p>
  
  <p><strong>Code :</strong></p>
  
  <pre><code>//initialising sigaction struct
  int init (void)
  
  {
    // Signal handler
    sigact.sa_handler = sigalrm_handler;
    sigact.sa_flags = 0;
    sigemptyset(&amp;sigact.sa_mask);
  
  
    // Linked list
    head = NULL;
  
    sigaction(SIGALRM, &amp;sigact, NULL);
    pthread_create(&amp;tid_sigrecv, NULL, (void *)deamon, NULL);
    return 1; // Implementation ready ?
  }
  </code></pre>
  
  <p>The sigsuspend part</p>
  
  <pre><code>void deamon(void * arg)
  {
    int sig;
    while(1) {
      sigset_t mask;
      sigemptyset(&amp;mask);
      sigaddset(&amp;mask, SIGALRM);
      sigsuspend(&amp;mask);
      printf("in thread\n");
    }
  }
  </code></pre>
  
  <p>Currently it only does not print "in thread" when a <code>sigarlm</code> is received, what should I do to use <code>sigsuspend</code> properly ? <strong>I am obliged to use <code>sigsuspend</code></strong></p>