From 846c2679997e939ff84d709a8270a425375ccaf6 Mon Sep 17 00:00:00 2001
From: "FeRD (Frank Dana)" <ferdnyc@gmail.com>
Date: Thu, 29 Aug 2019 22:48:58 -0400
Subject: [PATCH] Don't redefine gettid() on glibc 2.30+

---
 cinelerra-5.1/guicast/thread.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cinelerra-5.1/guicast/thread.h b/cinelerra-5.1/guicast/thread.h
index 216ecd2..b6a1be8 100644
--- a/cinelerra-5.1/guicast/thread.h
+++ b/cinelerra-5.1/guicast/thread.h
@@ -27,7 +27,11 @@
 #include <unistd.h>
 #include <sys/syscall.h>
 
-static inline int gettid() { return syscall(SYS_gettid, 0, 0, 0); }
+// Newer glibc >= 2.30 provides gettid() in unistd
+#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 30)
+    static inline int gettid() { return syscall(SYS_gettid, 0, 0, 0); }
+#endif
+
 
 // The thread does not autodelete by default.
 // If autodelete is 1 the thread autodeletes.
-- 
2.21.0

