ceph_assert(m_workers.empty());
}
-heartbeat_handle_d *HeartbeatMap::add_worker(const string& name, pthread_t thread_id)
+heartbeat_handle_d *HeartbeatMap::add_worker(string&& name, pthread_t thread_id)
{
std::unique_lock locker{m_rwlock};
ldout(m_cct, 10) << "add_worker '" << name << "'" << dendl;
- heartbeat_handle_d *h = new heartbeat_handle_d(name);
+ heartbeat_handle_d *h = new heartbeat_handle_d(std::move(name));
ANNOTATE_BENIGN_RACE_SIZED(&h->timeout, sizeof(h->timeout),
"heartbeat_handle_d timeout");
ANNOTATE_BENIGN_RACE_SIZED(&h->suicide_timeout, sizeof(h->suicide_timeout),
ceph::timespan suicide_grace = ceph::timespan::zero();
std::list<heartbeat_handle_d*>::iterator list_item;
- explicit heartbeat_handle_d(const std::string& n)
- : name(n)
+ explicit heartbeat_handle_d(std::string&& n)
+ : name(std::move(n))
{ }
};
class HeartbeatMap {
public:
// register/unregister
- heartbeat_handle_d *add_worker(const std::string& name, pthread_t thread_id);
+ heartbeat_handle_d *add_worker(std::string&& name, pthread_t thread_id);
void remove_worker(const heartbeat_handle_d *h);
// reset the timeout so that it expects another touch within grace amount of time