Browse Source
Merge pull request #1263 from trapexit/pthread_getname_np
Remove use of pthread_getname_np to work with older musl versions
pull/1269/head
trapexit
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
4 additions and
19 deletions
-
DEPENDENCIES
-
libfuse/include/thread_pool.hpp
|
@ -8,3 +8,4 @@ |
|
|
* nonstd::optional: https://github.com/martinmoene/optional-lite |
|
|
* nonstd::optional: https://github.com/martinmoene/optional-lite |
|
|
* fmt: https://github.com/fmtlib/fmt |
|
|
* fmt: https://github.com/fmtlib/fmt |
|
|
* concurrentqueue: https://github.com/cameron314/concurrentqueue |
|
|
* concurrentqueue: https://github.com/cameron314/concurrentqueue |
|
|
|
|
|
* scope_guard: https://github.com/Neargye/scope_guard |
|
@ -37,7 +37,7 @@ public: |
|
|
: _queue(), |
|
|
: _queue(), |
|
|
_queue_depth(0), |
|
|
_queue_depth(0), |
|
|
_max_queue_depth(std::max(thread_count_,max_queue_depth_)), |
|
|
_max_queue_depth(std::max(thread_count_,max_queue_depth_)), |
|
|
_name(get_thread_name(name_)) |
|
|
|
|
|
|
|
|
_name(name_) |
|
|
{ |
|
|
{ |
|
|
syslog(LOG_DEBUG, |
|
|
syslog(LOG_DEBUG, |
|
|
"threadpool (%s): spawning %u threads w/ max queue depth %u%s", |
|
|
"threadpool (%s): spawning %u threads w/ max queue depth %u%s", |
|
@ -100,19 +100,6 @@ public: |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private: |
|
|
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 |
|
|
static |
|
|
void* |
|
|
void* |
|
|
start_routine(void *arg_) |
|
|
start_routine(void *arg_) |
|
@ -208,12 +195,9 @@ public: |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
char name[16]; |
|
|
|
|
|
pthread_getname_np(t,name,sizeof(name)); |
|
|
|
|
|
syslog(LOG_DEBUG, |
|
|
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); |
|
|
pthread_exit(NULL); |
|
|
}; |
|
|
}; |
|
|