Cache current thread ID in TLS (dotnet/coreclr#24699)
authorLeandro A. F. Pereira <leandro.pereira@microsoft.com>
Wed, 22 May 2019 15:17:26 +0000 (08:17 -0700)
committerJan Vorlicek <janvorli@microsoft.com>
Wed, 22 May 2019 15:17:26 +0000 (08:17 -0700)
commit047307219f1ff16ac63b3d4824da69890ff7312d
treefbc60546fdc04a32335889a7e1efb42c37e179ab
parent0a94ab0f10bfd335585bed32408130671a990434
Cache current thread ID in TLS (dotnet/coreclr#24699)

While looking at the strace of `corerun` built with logging and
debugging information, I was amazed at the number of gettid() calls it
was making.  While system calls are cheap, they're still not free;
cache this number in the thread local storage area.  Adds a branch, but
it's just a comparison with 0, so it's fine in comparison.

Commit migrated from https://github.com/dotnet/coreclr/commit/41239feb757e7a5b5f0b710b810010df016d4391
src/coreclr/src/pal/src/include/pal/thread.hpp