reset_timeout(), clear_timeout() makes more sense than "touch".
Signed-off-by: Sage Weil <sage@newdream.net>
delete h;
}
-void HeartbeatMap::touch_worker(heartbeat_handle_d *h, time_t grace)
+void HeartbeatMap::reset_timeout(heartbeat_handle_d *h, time_t grace)
{
- ldout(m_cct, 20) << "touch_worker " << h->thread << " grace " << grace << dendl;
+ ldout(m_cct, 20) << "reset_timeout " << h->thread << " grace " << grace << dendl;
h->timeout = time(NULL) + grace;
}
+void HeartbeatMap::clear_timeout(heartbeat_handle_d *h)
+{
+ ldout(m_cct, 20) << "clear_timeout " << h->thread << dendl;
+ h->timeout = 0;
+}
+
bool HeartbeatMap::is_healthy()
{
m_rwlock.get_read();
public:
heartbeat_handle_d *add_worker(pthread_t thread, std::string name);
void remove_worker(heartbeat_handle_d *h);
- void touch_worker(heartbeat_handle_d *h, time_t grace);
+
+ void reset_timeout(heartbeat_handle_d *h, time_t grace);
+ void clear_timeout(heartbeat_handle_d *h);
bool is_healthy();
processing++;
ldout(cct,12) << "worker wq " << wq->name << " start processing " << item << dendl;
_lock.Unlock();
- cct->get_heartbeat_map()->touch_worker(hb, wq->timeout_interval);
+ cct->get_heartbeat_map()->reset_timeout(hb, wq->timeout_interval);
wq->_void_process(item);
_lock.Lock();
wq->_void_process_finish(item);
}
ldout(cct,15) << "worker waiting" << dendl;
- cct->get_heartbeat_map()->touch_worker(hb, 4);
+ cct->get_heartbeat_map()->reset_timeout(hb, 4);
_cond.WaitInterval(cct, _lock, utime_t(2, 0));
}
ldout(cct,0) << "worker finish" << dendl;