title: Thread.currentThread() performance
body: <p>I have Runnable queue that invokes one by one in specified thread.</p>
  <pre class="lang-kotlin prettyprint-override"><code>val queue = LinkedBlockingQueue&lt;() -&gt; Unit&gt;()
  
  val queueThread = thread {
    while(true)
      queue.take().invoke()
  }
  </code></pre>
  <p>Also I have function that adds Runnable and wait for it to complete.</p>
  <pre class="lang-kotlin prettyprint-override"><code>fun invokeOnQueueThread(toInvoke: () -&gt; Unit){
    if(Thread.currentThread() == queueThread)
      toInvoke()
    else {
      queue.offer(toInvoke)
      // Some waiting code...
    }
  }
  </code></pre>
  <p>I test if current thread is already inside my queue's thread to prevent unnecessary locking itself.</p>
  <p>So, the question is:</p>
  <p>Will <code>Thread.currentThread()</code> cause performance issues if I call this code very, very often?</p>