From 569537df9e7ba1f7c4651208ba78cdc2478a5147 Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Fri, 13 Oct 2023 00:03:59 -0500 Subject: [PATCH] Remove use of pthread_getname_np to work with older musl versions --- DEPENDENCIES | 1 + libfuse/include/thread_pool.hpp | 22 +++------------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/DEPENDENCIES b/DEPENDENCIES index ea4f8708..3b7c63a7 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -8,3 +8,4 @@ * nonstd::optional: https://github.com/martinmoene/optional-lite * fmt: https://github.com/fmtlib/fmt * concurrentqueue: https://github.com/cameron314/concurrentqueue +* scope_guard: https://github.com/Neargye/scope_guard diff --git a/libfuse/include/thread_pool.hpp b/libfuse/include/thread_pool.hpp index 864950c7..e20d710e 100644 --- a/libfuse/include/thread_pool.hpp +++ b/libfuse/include/thread_pool.hpp @@ -37,7 +37,7 @@ public: : _queue(), _queue_depth(0), _max_queue_depth(std::max(thread_count_,max_queue_depth_)), - _name(get_thread_name(name_)) + _name(name_) { syslog(LOG_DEBUG, "threadpool (%s): spawning %u threads w/ max queue depth %u%s", @@ -100,19 +100,6 @@ public: } private: - static - std::string - get_thread_name(std::string const name_) - { - if(!name_.empty()) - return name_; - - char name[16]; - pthread_getname_np(pthread_self(),name,sizeof(name)); - - return name; - } - static void* start_routine(void *arg_) @@ -208,12 +195,9 @@ public: } } - char name[16]; - pthread_getname_np(t,name,sizeof(name)); syslog(LOG_DEBUG, - "threadpool (%s): 1 thread removed named '%s'", - _name.c_str(), - name); + "threadpool (%s): 1 thread removed", + _name.c_str()); pthread_exit(NULL); };