title: Is operation of getting id of current thread time expensive?
body: <p>I'm going to use id of current running thread in a very performance critical place in my code, so I should choose whether to cache that id somewhere or to call a method (<code>gettid</code> for unix-like systems and <code>GetCurrentThreadId</code> for windows) for getting it every time. So which is better? Is getting thread id a system call?</p>