Skip to content

Commit 93fc6b8

Browse files
committed
Add check for support of SYS_gettid
To improve compatibility with old glibc version which lack SYS_gettid will use pthread_self() as a fallback.
1 parent 9472c5f commit 93fc6b8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Support/Unix/Threading.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ uint64_t llvm::get_threadid() {
140140
return uint64_t(getthrid());
141141
#elif defined(__ANDROID__)
142142
return uint64_t(gettid());
143-
#elif defined(__linux__)
143+
#elif defined(__linux__) && defined(SYS_gettid)
144144
return uint64_t(syscall(SYS_gettid));
145145
#else
146146
return uint64_t(pthread_self());

0 commit comments

Comments
 (0)