diff options
author | Abseil Team <absl-team@google.com> | 2023-06-09 02:27:24 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-06-09 02:28:32 -0700 |
commit | 66eae02ea7c8c41108590de510e70517304d2b6a (patch) | |
tree | 248656f6309bcd03e40a4f50abd6c25d56a28b96 /absl/base/internal | |
parent | afc9206b3d55b1f21790c536e0a3a4fc0b57f68f (diff) | |
download | abseil-66eae02ea7c8c41108590de510e70517304d2b6a.tar.gz abseil-66eae02ea7c8c41108590de510e70517304d2b6a.tar.bz2 abseil-66eae02ea7c8c41108590de510e70517304d2b6a.zip |
Implement GetTID for NACL platform.
in NACL pthread_self() returns a pointer that isn't directly convertible to arithmetic type.
PiperOrigin-RevId: 539023020
Change-Id: I3745ec5565f3a99ccb1d9df12c27a80e57ca4755
Diffstat (limited to 'absl/base/internal')
-rw-r--r-- | absl/base/internal/sysinfo.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/absl/base/internal/sysinfo.cc b/absl/base/internal/sysinfo.cc index 7de8ead2..605a11eb 100644 --- a/absl/base/internal/sysinfo.cc +++ b/absl/base/internal/sysinfo.cc @@ -426,6 +426,15 @@ pid_t GetTID() { return static_cast<pid_t>(tid); } +#elif defined(__native_client__) + +pid_t GetTID() { + auto* thread = pthread_self(); + static_assert(sizeof(pid_t) == sizeof(thread), + "In NaCL int expected to be the same size as a pointer"); + return reinterpret_cast<pid_t>(thread); +} + #else // Fallback implementation of `GetTID` using `pthread_self`. |