};
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;
}
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; };