title: Is it safe to call sleep(3), usleep(3) or nanosleep(2) in thread?
body: <p>I heard that some unix implementations use <code>alarm(2)</code> to implement <code>sleep</code> function.
  If it is true, I guess following code might not safe because <code>SIGALRM</code> may be sent to process, which is received by root thread.</p>
  
  <pre><code>#include &lt;pthread.h&gt;
  #include &lt;unistd.h&gt;
  
  void *doit(void *arg) {
      sleep(1);
      return NULL;
  }
  
  int main(int argc, char *argv[]) {
      pthread_t th;
  
      pthread_create(&amp;th, NULL, doit, NULL);
      sleep(5);
      pthread_join(th, NULL);
      return 0;
  }
  </code></pre>
  
  <p>Is it safe to call <code>sleep(3)</code>, <code>usleep(3)</code> or <code>nanosleep(2)</code> in thread?</p>