title: Getting thread ID from parallel package
body: <p>I have a simple shared memory code <code>helloworld.R</code> code : </p>
  
  <pre><code>library(parallel)
  nCores &lt;- detectCores()
  v&lt;-character(length=nCores)
  tid&lt;-someFuncToGetThreadID()     # &lt;---What function to use here?
  v&lt;-mclapply(v,function(x) x=sprintf("Hello World from thread : %i",tid))
  </code></pre>
  
  <p>How do I get the thread ID (<code>tid</code>) for each thread?</p>