From 25dad5a53168e185548601be93dfd29d070188f8 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Fri, 20 Oct 2023 16:45:07 -0700 Subject: [PATCH] [wpinet] TCPConnector_parallel: Don't use thread_local (#5791) Thread_local causes issues with LabVIEW, which makes calls on a thread pool. --- .../tcpsockets/cpp/TCPConnector_parallel.cpp | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/wpinet/src/main/native/thirdparty/tcpsockets/cpp/TCPConnector_parallel.cpp b/wpinet/src/main/native/thirdparty/tcpsockets/cpp/TCPConnector_parallel.cpp index 1d979cb484..32654e90eb 100644 --- a/wpinet/src/main/native/thirdparty/tcpsockets/cpp/TCPConnector_parallel.cpp +++ b/wpinet/src/main/native/thirdparty/tcpsockets/cpp/TCPConnector_parallel.cpp @@ -15,14 +15,6 @@ using namespace wpi; -// MSVC < 1900 doesn't have support for thread_local -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -// clang check for availability of thread_local -#if !defined(__has_feature) || __has_feature(cxx_thread_local) -#define HAVE_THREAD_LOCAL -#endif -#endif - std::unique_ptr TCPConnector::connect_parallel( std::span> servers, Logger& logger, int timeout) { @@ -33,18 +25,10 @@ std::unique_ptr TCPConnector::connect_parallel( // structure to make sure we don't start duplicate workers struct GlobalState { wpi::mutex mtx; -#ifdef HAVE_THREAD_LOCAL - SmallSet, 16> active; -#else SmallSet, 16> active; -#endif }; -#ifdef HAVE_THREAD_LOCAL - thread_local auto global = std::make_shared(); -#else static auto global = std::make_shared(); auto this_id = std::this_thread::get_id(); -#endif auto local = global; // copy to an automatic variable for lambda capture // structure shared between threads and this function @@ -63,12 +47,8 @@ std::unique_ptr TCPConnector::connect_parallel( for (const auto& server : servers) { std::pair server_copy{std::string{server.first}, server.second}; -#ifdef HAVE_THREAD_LOCAL - const auto& active_tracker = server_copy; -#else std::tuple active_tracker{ this_id, server_copy.first, server_copy.second}; -#endif // don't start a new worker if we had a previously still-active connection // attempt to the same server