Commit 66eae02e by Abseil Team Committed by Copybara-Service

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
parent afc9206b
......@@ -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`.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment