title: The thread ID returned by pthread_self() is not the same thing as the kernel thread ID returned by a call to gettid(2)
body: <p>That quote is from the <a href="http://linux.die.net/man/3/pthread_self" rel="noreferrer">man page of pthread_self()</a>.</p>
  
  <p><strong><em>So, on what basis should I decide whether I should use <code>pthread_self</code> or <code>gettid</code> to determine which thread is running the function?</em></strong></p>
  
  <p>Both are non portable.<br>
  Why are there two different functions to get the thread ID?</p>