summaryrefslogtreecommitdiffstats
path: root/src/common/Thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/Thread.h')
-rw-r--r--src/common/Thread.h12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/common/Thread.h b/src/common/Thread.h
index d3892c1b36b..8dc0e6c3cbe 100644
--- a/src/common/Thread.h
+++ b/src/common/Thread.h
@@ -17,8 +17,8 @@
#define CEPH_THREAD_H
#include <functional>
+#include <string>
#include <string_view>
-#include <system_error>
#include <thread>
#include <cstring>
@@ -27,7 +27,6 @@
#include "include/ceph_assert.h"
#include "include/compat.h"
-#include "include/spinlock.h"
extern pid_t ceph_gettid();
@@ -36,7 +35,7 @@ class Thread {
pthread_t thread_id;
pid_t pid;
int cpuid;
- static inline thread_local std::string thread_name;
+ std::string thread_name;
void *entry_wrapper();
@@ -64,15 +63,10 @@ class Thread {
int join(void **prval = 0);
int detach();
int set_affinity(int cpuid);
- static const std::string get_thread_name() {
- return Thread::thread_name;
- }
};
// Functions for with std::thread
-void set_thread_name(std::thread& t, const std::string& s);
-std::string get_thread_name(const std::thread& t);
void kill(std::thread& t, int signal);
template<typename Fun, typename... Args>
@@ -81,7 +75,7 @@ std::thread make_named_thread(std::string_view n,
Args&& ...args) {
return std::thread([n = std::string(n)](auto&& fun, auto&& ...args) {
- ceph_pthread_setname(pthread_self(), n.data());
+ ceph_pthread_setname(n.data());
std::invoke(std::forward<Fun>(fun),
std::forward<Args>(args)...);
}, std::forward<Fun>(fun), std::forward<Args>(args)...);