aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2024-05-13 16:57:03 +0200
committerVasil Dimov <vd@FreeBSD.org>2024-05-16 18:16:46 +0200
commitd35ba1b3f16071b8fe9b36398ba15352dbf2a54d (patch)
tree1c99fb1a3e0f49eb758cb6931bc068f4cb1bf7d8 /configure.ac
parentb94061902e52132489fe296c12396798700f1f35 (diff)
util: avoid using thread_local variable that has a destructor
Store the thread name in a `thread_local` variable of type `char[]` instead of `std::string`. This avoids calling the destructor when the thread exits. This is a workaround for https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278701 For type-safety, return `std::string` from `util::ThreadGetInternalName()` instead of `char[]`. As a side effect of this change, we no longer store a reference to a `thread_local` variable in `CLockLocation`. This was dangerous because if the thread quits while the reference still exists (in the global variable `lock_data`, see inside `GetLockData()`) then the reference will become dangling.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac5
1 files changed, 0 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index dfb7b99756..bfc1e54921 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1049,11 +1049,6 @@ if test "$use_thread_local" = "yes" || test "$use_thread_local" = "auto"; then
dnl https://gist.github.com/jamesob/fe9a872051a88b2025b1aa37bfa98605
AC_MSG_RESULT([no])
;;
- *freebsd*)
- dnl FreeBSD's implementation of thread_local is also buggy (per
- dnl https://groups.google.com/d/msg/bsdmailinglist/22ncTZAbDp4/Dii_pII5AwAJ)
- AC_MSG_RESULT([no])
- ;;
*)
AC_DEFINE([HAVE_THREAD_LOCAL], [1], [Define if thread_local is supported.])
AC_MSG_RESULT([yes])