[PyTorch] Use c10::ThreadLocal instead thread_local in record_function.cpp for specific __GLIBCXX__ on Android (#57689)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57689
* Older versions of libgnustd have issues with thread_local C++ qualifier on Android devices prior to r17+. Use c10::tls<> wrapper with smart pointer semantics in such cases.
* Convenient macro `C10_DEFINE_TLS_static` was added as well:
```
// Define static TLS variable str_tls_ of type std::string
C10_DEFINE_TLS_static(std::string, str_tls_);
//////// Excercise it ////////
{
*str_tls_ = "abc";
assert(str_tls_->length(), 3);
}
```
ghstack-source-id: 128233742
Test Plan: CI +
Reviewed By: ilia-cher
Differential Revision: D27875779
fbshipit-source-id: 7764f96ac1e121051c6ea66eabcedb9ef54d290e