From 1499f10bc2c9a0fd483015adc3c312c473a04289 Mon Sep 17 00:00:00 2001 From: ShadiBahaa Date: Mon, 13 Apr 2026 19:32:41 +0200 Subject: [PATCH] fix: add HaikuOS support for GetTID() in sysinfo.cc Add a platform-specific GetTID() implementation for HaikuOS using Haiku's native find_thread(NULL) API, which returns the current thread's ID. Without this, HaikuOS falls through to the generic pthread_self() fallback which causes a compilation failure due to type incompatibility. Fixes #1981 --- absl/base/internal/sysinfo.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/absl/base/internal/sysinfo.cc b/absl/base/internal/sysinfo.cc index a62dd31c2..92c4a1ce3 100644 --- a/absl/base/internal/sysinfo.cc +++ b/absl/base/internal/sysinfo.cc @@ -50,6 +50,10 @@ #include #endif +#if defined(__HAIKU__) +#include +#endif + #include #include @@ -466,6 +470,10 @@ pid_t GetTID() { return static_cast(zx_thread_self()); } +#elif defined(__HAIKU__) + +pid_t GetTID() { return find_thread(NULL); } + #else // Fallback implementation of `GetTID` using `pthread_self`.