Skip to content

Commit 1499f10

Browse files
committed
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
1 parent ea64b6e commit 1499f10

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

absl/base/internal/sysinfo.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
#include <zircon/process.h>
5151
#endif
5252

53+
#if defined(__HAIKU__)
54+
#include <OS.h>
55+
#endif
56+
5357
#include <string.h>
5458

5559
#include <cassert>
@@ -466,6 +470,10 @@ pid_t GetTID() {
466470
return static_cast<pid_t>(zx_thread_self());
467471
}
468472

473+
#elif defined(__HAIKU__)
474+
475+
pid_t GetTID() { return find_thread(NULL); }
476+
469477
#else
470478

471479
// Fallback implementation of `GetTID` using `pthread_self`.

0 commit comments

Comments
 (0)