summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qlogging.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2025-01-14 15:32:08 -0800
committerThiago Macieira <thiago.macieira@intel.com>2025-01-20 18:03:39 -0800
commite3ca467f407ae5f8cb56aab6848e4809737ba2c4 (patch)
tree2ef10deaee80d97a38988e336deb441c1e042a95 /src/corelib/global/qlogging.cpp
parente90115b5f7dafb1d6acd347634b14e12b6ff88f1 (diff)
qlogging.cpp: move the qt_gettid() function to a header
Just for code organization. Change-Id: Ifa5da67b98f07f669e4ffffd1a0fc10b4087b6b2 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Diffstat (limited to 'src/corelib/global/qlogging.cpp')
-rw-r--r--src/corelib/global/qlogging.cpp39
1 files changed, 1 insertions, 38 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 9e2451d101b..d224fbe6f68 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -21,6 +21,7 @@
#include "qthread.h"
#include "private/qloggingregistry_p.h"
#include "private/qcoreapplication_p.h"
+#include "qgettid_p.h"
#include <qtcore_tracepoints_p.h>
#endif
#ifdef Q_OS_WIN
@@ -79,44 +80,6 @@ extern char *__progname;
# include <cxxabi.h>
#endif // QLOGGING_USE_EXECINFO_BACKTRACE
-#ifndef QT_BOOTSTRAPPED
-#if defined(Q_OS_LINUX) && (defined(__GLIBC__) || __has_include(<sys/syscall.h>))
-# include <sys/syscall.h>
-
-# if defined(Q_OS_ANDROID) && !defined(SYS_gettid)
-# define SYS_gettid __NR_gettid
-# endif
-
-static long qt_gettid()
-{
- // no error handling
- // this syscall has existed since Linux 2.4.11 and cannot fail
- return syscall(SYS_gettid);
-}
-#elif defined(Q_OS_DARWIN)
-# include <pthread.h>
-static int qt_gettid()
-{
- // no error handling: this call cannot fail
- __uint64_t tid;
- pthread_threadid_np(NULL, &tid);
- return tid;
-}
-#elif defined(Q_OS_FREEBSD_KERNEL) && defined(__FreeBSD_version) && __FreeBSD_version >= 900031
-# include <pthread_np.h>
-static int qt_gettid()
-{
- return pthread_getthreadid_np();
-}
-#else
-static QT_PREPEND_NAMESPACE(qint64) qt_gettid()
-{
- QT_USE_NAMESPACE
- return qintptr(QThread::currentThreadId());
-}
-#endif
-#endif // !QT_BOOTSTRAPPED
-
#include <cstdlib>
#include <algorithm>
#include <chrono>