aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2024-05-18 10:59:55 +0800
committerfanquake <fanquake@gmail.com>2024-05-21 10:29:51 +0100
commit17fe948cce2eb75f0f3f4b0db9d0d90648c7d4af (patch)
tree08ae5f10fd8a883e68fd48f6b73590d99179a527
parent1e7c20bc19a216269c646177ab90cfa084c096a5 (diff)
downloadbitcoin-17fe948cce2eb75f0f3f4b0db9d0d90648c7d4af.tar.xz
build: remove --enable-threadlocal
-rw-r--r--configure.ac34
-rw-r--r--src/init/common.cpp8
-rw-r--r--src/test/util_threadnames_tests.cpp7
-rw-r--r--src/util/threadnames.cpp11
4 files changed, 1 insertions, 59 deletions
diff --git a/configure.ac b/configure.ac
index b80466b13e..d539e4436f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -244,12 +244,6 @@ AC_ARG_ENABLE([lcov-branch-coverage],
[use_lcov_branch=yes],
[use_lcov_branch=no])
-AC_ARG_ENABLE([threadlocal],
- [AS_HELP_STRING([--enable-threadlocal],
- [enable features that depend on the c++ thread_local keyword (currently just thread names in debug logs). (default is to enable if there is platform support)])],
- [use_thread_local=$enableval],
- [use_thread_local=auto])
-
AC_ARG_ENABLE([zmq],
[AS_HELP_STRING([--disable-zmq],
[disable ZMQ notifications])],
@@ -1028,34 +1022,6 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
[AC_MSG_RESULT([no])]
)
-if test "$use_thread_local" = "yes" || test "$use_thread_local" = "auto"; then
- TEMP_LDFLAGS="$LDFLAGS"
- LDFLAGS="$TEMP_LDFLAGS $PTHREAD_CFLAGS"
- AC_MSG_CHECKING([for thread_local support])
- AC_LINK_IFELSE([AC_LANG_SOURCE([
- #include <thread>
- static thread_local int foo = 0;
- static void run_thread() { foo++;}
- int main(){
- for(int i = 0; i < 10; i++) { std::thread(run_thread).detach();}
- return foo;
- }
- ])],
- [
- case $host in
- *)
- AC_DEFINE([HAVE_THREAD_LOCAL], [1], [Define if thread_local is supported.])
- AC_MSG_RESULT([yes])
- ;;
- esac
- ],
- [
- AC_MSG_RESULT([no])
- ]
- )
- LDFLAGS="$TEMP_LDFLAGS"
-fi
-
dnl Check for different ways of gathering OS randomness
AC_MSG_CHECKING([for Linux getrandom function])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
diff --git a/src/init/common.cpp b/src/init/common.cpp
index 3a6df3e8bd..f473ee6d66 100644
--- a/src/init/common.cpp
+++ b/src/init/common.cpp
@@ -31,11 +31,7 @@ void AddLoggingArgs(ArgsManager& argsman)
argsman.AddArg("-logips", strprintf("Include IP addresses in debug output (default: %u)", DEFAULT_LOGIPS), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-loglevel=<level>|<category>:<level>", strprintf("Set the global or per-category severity level for logging categories enabled with the -debug configuration option or the logging RPC. Possible values are %s (default=%s). The following levels are always logged: error, warning, info. If <category>:<level> is supplied, the setting will override the global one and may be specified multiple times to set multiple category-specific levels. <category> can be: %s.", LogInstance().LogLevelsString(), LogInstance().LogLevelToStr(BCLog::DEFAULT_LOG_LEVEL), LogInstance().LogCategoriesString()), ArgsManager::DISALLOW_NEGATION | ArgsManager::DISALLOW_ELISION | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-logtimestamps", strprintf("Prepend debug output with timestamp (default: %u)", DEFAULT_LOGTIMESTAMPS), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
-#ifdef HAVE_THREAD_LOCAL
- argsman.AddArg("-logthreadnames", strprintf("Prepend debug output with name of the originating thread (only available on platforms supporting thread_local) (default: %u)", DEFAULT_LOGTHREADNAMES), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
-#else
- argsman.AddHiddenArgs({"-logthreadnames"});
-#endif
+ argsman.AddArg("-logthreadnames", strprintf("Prepend debug output with name of the originating thread (default: %u)", DEFAULT_LOGTHREADNAMES), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-logsourcelocations", strprintf("Prepend debug output with name of the originating source location (source file, line number and function name) (default: %u)", DEFAULT_LOGSOURCELOCATIONS), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-logtimemicros", strprintf("Add microsecond precision to debug timestamps (default: %u)", DEFAULT_LOGTIMEMICROS), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-loglevelalways", strprintf("Always prepend a category and level (default: %u)", DEFAULT_LOGLEVELALWAYS), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
@@ -50,9 +46,7 @@ void SetLoggingOptions(const ArgsManager& args)
LogInstance().m_print_to_console = args.GetBoolArg("-printtoconsole", !args.GetBoolArg("-daemon", false));
LogInstance().m_log_timestamps = args.GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS);
LogInstance().m_log_time_micros = args.GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS);
-#ifdef HAVE_THREAD_LOCAL
LogInstance().m_log_threadnames = args.GetBoolArg("-logthreadnames", DEFAULT_LOGTHREADNAMES);
-#endif
LogInstance().m_log_sourcelocations = args.GetBoolArg("-logsourcelocations", DEFAULT_LOGSOURCELOCATIONS);
LogInstance().m_always_print_category_level = args.GetBoolArg("-loglevelalways", DEFAULT_LOGLEVELALWAYS);
diff --git a/src/test/util_threadnames_tests.cpp b/src/test/util_threadnames_tests.cpp
index df5b1a4461..174052d5fa 100644
--- a/src/test/util_threadnames_tests.cpp
+++ b/src/test/util_threadnames_tests.cpp
@@ -11,8 +11,6 @@
#include <thread>
#include <vector>
-#include <config/bitcoin-config.h> // IWYU pragma: keep
-
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_SUITE(util_threadnames_tests)
@@ -52,11 +50,6 @@ std::set<std::string> RenameEnMasse(int num_threads)
*/
BOOST_AUTO_TEST_CASE(util_threadnames_test_rename_threaded)
{
-#if !defined(HAVE_THREAD_LOCAL)
- // This test doesn't apply to platforms where we don't have thread_local.
- return;
-#endif
-
std::set<std::string> names = RenameEnMasse(100);
BOOST_CHECK_EQUAL(names.size(), 100U);
diff --git a/src/util/threadnames.cpp b/src/util/threadnames.cpp
index ba074e30e0..0249de37e3 100644
--- a/src/util/threadnames.cpp
+++ b/src/util/threadnames.cpp
@@ -37,10 +37,6 @@ static void SetThreadName(const char* name)
#endif
}
-// If we have thread_local, just keep thread ID and name in a thread_local
-// global.
-#if defined(HAVE_THREAD_LOCAL)
-
/**
* The name of the thread. We use char array instead of std::string to avoid
* complications with running a destructor when the thread exits. Avoid adding
@@ -58,13 +54,6 @@ static void SetInternalName(const std::string& name)
g_thread_name[copy_bytes] = '\0';
}
-// Without thread_local available, don't handle internal name at all.
-#else
-
-std::string util::ThreadGetInternalName() { return ""; }
-static void SetInternalName(const std::string& name) { }
-#endif
-
void util::ThreadRename(const std::string& name)
{
SetThreadName(("b-" + name).c_str());