From 9bf1fe943994b956a7ea1a9aa5cd8097b8df3bb3 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 6 Jan 2020 14:38:48 +0100 Subject: [PATCH] LibC: Remove thread-specific TID cache As Sergey pointed out forever ago, this value is wrong after fork(). --- Libraries/LibC/unistd.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Libraries/LibC/unistd.cpp b/Libraries/LibC/unistd.cpp index f53752150f..7a48eff5d7 100644 --- a/Libraries/LibC/unistd.cpp +++ b/Libraries/LibC/unistd.cpp @@ -527,13 +527,9 @@ int ftruncate(int fd, off_t length) __RETURN_WITH_ERRNO(rc, rc, -1); } -__thread int t_cached_tid = -1; - int gettid() { - if (t_cached_tid == -1) - t_cached_tid = syscall(SC_gettid); - return t_cached_tid; + return syscall(SC_gettid); } int donate(int tid)