From d3f673dc6f2318c72534196669e1b30a8aca45a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 31 Oct 2023 14:32:30 +0800 Subject: [PATCH] Init: remove separate thread of displayserver and qt/gtk stuff detection These threads are detached. If the main thread exits before the sub threads end, fastfetch may crash in various ways. It barely benefits performance. `hyperfine` shows completely no difference between `--thread` enabled and disabled. Let's get rid of it. --- src/common/init.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/common/init.c b/src/common/init.c index 2fc032a27..5c5b2307a 100644 --- a/src/common/init.c +++ b/src/common/init.c @@ -51,29 +51,6 @@ void ffInitInstance(void) defaultConfig(); } -#if defined(FF_HAVE_THREADS) && !(defined(__APPLE__) || defined(_WIN32) || defined(__ANDROID__)) - -#include "detection/gtk_qt/gtk_qt.h" - -#define FF_START_DETECTION_THREADS - -FF_THREAD_ENTRY_DECL_WRAPPER_NOPARAM(ffConnectDisplayServer) -FF_THREAD_ENTRY_DECL_WRAPPER_NOPARAM(ffDetectQt) -FF_THREAD_ENTRY_DECL_WRAPPER_NOPARAM(ffDetectGTK2) -FF_THREAD_ENTRY_DECL_WRAPPER_NOPARAM(ffDetectGTK3) -FF_THREAD_ENTRY_DECL_WRAPPER_NOPARAM(ffDetectGTK4) - -void startDetectionThreads(void) -{ - ffThreadDetach(ffThreadCreate(ffConnectDisplayServerThreadMain, NULL)); - ffThreadDetach(ffThreadCreate(ffDetectQtThreadMain, NULL)); - ffThreadDetach(ffThreadCreate(ffDetectGTK2ThreadMain, NULL)); - ffThreadDetach(ffThreadCreate(ffDetectGTK3ThreadMain, NULL)); - ffThreadDetach(ffThreadCreate(ffDetectGTK4ThreadMain, NULL)); -} - -#endif //FF_HAVE_THREADS - static volatile bool ffDisableLinewrap = true; static volatile bool ffHideCursor = true;