Skip to content

Commit 17fe948

Browse files
committed
build: remove --enable-threadlocal
1 parent 1e7c20b commit 17fe948

File tree

4 files changed

+1
-59
lines changed

4 files changed

+1
-59
lines changed

configure.ac

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,6 @@ AC_ARG_ENABLE([lcov-branch-coverage],
244244
[use_lcov_branch=yes],
245245
[use_lcov_branch=no])
246246

247-
AC_ARG_ENABLE([threadlocal],
248-
[AS_HELP_STRING([--enable-threadlocal],
249-
[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)])],
250-
[use_thread_local=$enableval],
251-
[use_thread_local=auto])
252-
253247
AC_ARG_ENABLE([zmq],
254248
[AS_HELP_STRING([--disable-zmq],
255249
[disable ZMQ notifications])],
@@ -1028,34 +1022,6 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
10281022
[AC_MSG_RESULT([no])]
10291023
)
10301024

1031-
if test "$use_thread_local" = "yes" || test "$use_thread_local" = "auto"; then
1032-
TEMP_LDFLAGS="$LDFLAGS"
1033-
LDFLAGS="$TEMP_LDFLAGS $PTHREAD_CFLAGS"
1034-
AC_MSG_CHECKING([for thread_local support])
1035-
AC_LINK_IFELSE([AC_LANG_SOURCE([
1036-
#include <thread>
1037-
static thread_local int foo = 0;
1038-
static void run_thread() { foo++;}
1039-
int main(){
1040-
for(int i = 0; i < 10; i++) { std::thread(run_thread).detach();}
1041-
return foo;
1042-
}
1043-
])],
1044-
[
1045-
case $host in
1046-
*)
1047-
AC_DEFINE([HAVE_THREAD_LOCAL], [1], [Define if thread_local is supported.])
1048-
AC_MSG_RESULT([yes])
1049-
;;
1050-
esac
1051-
],
1052-
[
1053-
AC_MSG_RESULT([no])
1054-
]
1055-
)
1056-
LDFLAGS="$TEMP_LDFLAGS"
1057-
fi
1058-
10591025
dnl Check for different ways of gathering OS randomness
10601026
AC_MSG_CHECKING([for Linux getrandom function])
10611027
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[

src/init/common.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ void AddLoggingArgs(ArgsManager& argsman)
3131
argsman.AddArg("-logips", strprintf("Include IP addresses in debug output (default: %u)", DEFAULT_LOGIPS), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
3232
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);
3333
argsman.AddArg("-logtimestamps", strprintf("Prepend debug output with timestamp (default: %u)", DEFAULT_LOGTIMESTAMPS), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
34-
#ifdef HAVE_THREAD_LOCAL
35-
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);
36-
#else
37-
argsman.AddHiddenArgs({"-logthreadnames"});
38-
#endif
34+
argsman.AddArg("-logthreadnames", strprintf("Prepend debug output with name of the originating thread (default: %u)", DEFAULT_LOGTHREADNAMES), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
3935
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);
4036
argsman.AddArg("-logtimemicros", strprintf("Add microsecond precision to debug timestamps (default: %u)", DEFAULT_LOGTIMEMICROS), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
4137
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)
5046
LogInstance().m_print_to_console = args.GetBoolArg("-printtoconsole", !args.GetBoolArg("-daemon", false));
5147
LogInstance().m_log_timestamps = args.GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS);
5248
LogInstance().m_log_time_micros = args.GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS);
53-
#ifdef HAVE_THREAD_LOCAL
5449
LogInstance().m_log_threadnames = args.GetBoolArg("-logthreadnames", DEFAULT_LOGTHREADNAMES);
55-
#endif
5650
LogInstance().m_log_sourcelocations = args.GetBoolArg("-logsourcelocations", DEFAULT_LOGSOURCELOCATIONS);
5751
LogInstance().m_always_print_category_level = args.GetBoolArg("-loglevelalways", DEFAULT_LOGLEVELALWAYS);
5852

src/test/util_threadnames_tests.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
#include <thread>
1212
#include <vector>
1313

14-
#include <config/bitcoin-config.h> // IWYU pragma: keep
15-
1614
#include <boost/test/unit_test.hpp>
1715

1816
BOOST_AUTO_TEST_SUITE(util_threadnames_tests)
@@ -52,11 +50,6 @@ std::set<std::string> RenameEnMasse(int num_threads)
5250
*/
5351
BOOST_AUTO_TEST_CASE(util_threadnames_test_rename_threaded)
5452
{
55-
#if !defined(HAVE_THREAD_LOCAL)
56-
// This test doesn't apply to platforms where we don't have thread_local.
57-
return;
58-
#endif
59-
6053
std::set<std::string> names = RenameEnMasse(100);
6154

6255
BOOST_CHECK_EQUAL(names.size(), 100U);

src/util/threadnames.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ static void SetThreadName(const char* name)
3737
#endif
3838
}
3939

40-
// If we have thread_local, just keep thread ID and name in a thread_local
41-
// global.
42-
#if defined(HAVE_THREAD_LOCAL)
43-
4440
/**
4541
* The name of the thread. We use char array instead of std::string to avoid
4642
* complications with running a destructor when the thread exits. Avoid adding
@@ -58,13 +54,6 @@ static void SetInternalName(const std::string& name)
5854
g_thread_name[copy_bytes] = '\0';
5955
}
6056

61-
// Without thread_local available, don't handle internal name at all.
62-
#else
63-
64-
std::string util::ThreadGetInternalName() { return ""; }
65-
static void SetInternalName(const std::string& name) { }
66-
#endif
67-
6857
void util::ThreadRename(const std::string& name)
6958
{
7059
SetThreadName(("b-" + name).c_str());

0 commit comments

Comments
 (0)