]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/msg/async/Stack.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / msg / async / Stack.h
index 6a2188b5a9c7921a5d152cee5c9103afa54677f3..97201787c73cbdacdfa329d79feb3a8f9cb30441 100644 (file)
@@ -293,13 +293,18 @@ class Worker {
 };
 
 class NetworkStack {
-  unsigned num_workers = 0;
   ceph::spinlock pool_spin;
   bool started = false;
 
-  std::function<void ()> add_thread(unsigned i);
+  std::function<void ()> add_thread(Worker* w);
 
   virtual Worker* create_worker(CephContext *c, unsigned i) = 0;
+  virtual void rename_thread(unsigned id) {
+    static constexpr int TASK_COMM_LEN = 16;
+    char tp_name[TASK_COMM_LEN];
+    sprintf(tp_name, "msgr-worker-%u", id);
+    ceph_pthread_setname(pthread_self(), tp_name);
+  }
 
  protected:
   CephContext *cct;
@@ -334,11 +339,11 @@ class NetworkStack {
   }
   void drain();
   unsigned get_num_worker() const {
-    return num_workers;
+    return workers.size();
   }
 
   // direct is used in tests only
-  virtual void spawn_worker(unsigned i, std::function<void ()> &&) = 0;
+  virtual void spawn_worker(std::function<void ()> &&) = 0;
   virtual void join_worker(unsigned i) = 0;
 
   virtual bool is_ready() { return true; };