summaryrefslogtreecommitdiff
path: root/absl/base/internal/sysinfo.cc
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2023-09-07 08:02:09 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-09-07 08:03:07 -0700
commit1981cf8c0206657a16f73f48d43a313c65485d5e (patch)
tree48da0c92777499600137dc845cca9f12e24f2a00 /absl/base/internal/sysinfo.cc
parent2c4ce9b2ad339b0cd2a3a4d67a62e288d5b23ef4 (diff)
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
Diffstat (limited to 'absl/base/internal/sysinfo.cc')
-rw-r--r--absl/base/internal/sysinfo.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/absl/base/internal/sysinfo.cc b/absl/base/internal/sysinfo.cc
index 5b427fa5..79eaba3e 100644
--- a/absl/base/internal/sysinfo.cc
+++ b/absl/base/internal/sysinfo.cc
@@ -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(); }