Commit 1981cf8c by Derek Mauro Committed by Copybara-Service

Fix GetTID() on FreeBSD

https://github.com/abseil/abseil-cpp/issues/1518#issuecomment-1709098904
pointed out that the previous untested fix doesn't work because
pthread_getthreadid_np() has a different signature on Darwin.

Follow up to https://github.com/abseil/abseil-cpp/commit/b9707b7d7845f9710ae6d5906827b833fdcc2754

Fixes #1518

PiperOrigin-RevId: 563432451
Change-Id: Id0a9212e9c4413fa520a42934efaed2a06ca5dbc
parent 2c4ce9b2
......@@ -429,7 +429,7 @@ pid_t GetTID() {
return tid;
}
#elif defined(__APPLE__) || defined(__FreeBSD__)
#elif defined(__APPLE__)
pid_t GetTID() {
uint64_t tid;
......@@ -440,6 +440,10 @@ pid_t GetTID() {
return static_cast<pid_t>(tid);
}
#elif defined(__FreeBSD__)
pid_t GetTID() { return static_cast<pid_t>(pthread_getthreadid_np()); }
#elif defined(__OpenBSD__)
pid_t GetTID() { return getthrid(); }
......
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