[PATCH v2 1/1] threadpool: Do not use gettid on GNU/Hurd.
gettid is not available on GNU/Hurd and not defined in
glibc. It is specific to Linux for its thread
implementation, while GNU/Hurd uses a different one.
Without a definition, compiling libgav1 on GNU/Hurd
will result in an error of undeclared function.
In commit f06328bf, we have already fixed a mistake
usage of a pthread api on GNU/Hurd. The reason why
this error is not noticed might be that abseil has
failed to build on GNU/Hurd for a long time,
therefore libgav1 might have not been compiled once
as well.
Change-Id: Id0a8f8dbd7660d4dbd0f2968b670d439a273fe20
Signed-off-by: Yuqian Yang <crupest@crupest.life>
---
src/utils/threadpool.cc | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/utils/threadpool.cc b/src/utils/threadpool.cc
index ad79ba2..43c6b64 100644
--- a/src/utils/threadpool.cc
+++ b/src/utils/threadpool.cc
@@ -44,7 +44,8 @@
// Linux.
#if defined(__ANDROID__)
static pid_t GetTid() { return gettid(); }
-#elif defined(__GLIBC__)
+#elif defined(__GLIBC__) && !defined(__GNU__)
+// GNU/Hurd does not have gettid.
// The glibc wrapper for the gettid() system call was added in glibc 2.30.
// Emulate it for older versions of glibc.
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 30)
@@ -54,7 +55,7 @@ static pid_t GetTid() { return gettid(); }
static pid_t GetTid() { return static_cast<pid_t>(syscall(SYS_gettid)); }
#endif // glibc 2.30 or later.
-#endif // defined(__GLIBC__)
+#endif // defined(__GLIBC__) && !defined(__GNU__)
namespace libgav1 {
--
Yuqian Yang <crupest@crupest.life>
Reply to: