]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_context: only wake up periodically if heartbeat_interval is set
authorSage Weil <sage@newdream.net>
Thu, 28 Jul 2011 16:50:53 +0000 (09:50 -0700)
committerSage Weil <sage@newdream.net>
Thu, 28 Jul 2011 16:50:53 +0000 (09:50 -0700)
Signed-off-by: Sage Weil <sage@newdream.net>
src/common/ceph_context.cc

index 4b3b0685c43415912162bb6f0ac25617fb34a274..1581d06f8768d5745ef3edcd9b223dc110ff70ce 100644 (file)
@@ -46,11 +46,14 @@ public:
   void *entry()
   {
     while (1) {
-      struct timespec timeout;
-      clock_gettime(CLOCK_REALTIME, &timeout);
-      timeout.tv_sec += _cct->_conf->heartbeat_interval;
-
-      sem_timedwait(&_sem, &timeout);
+      if (_cct->_conf->heartbeat_interval) {
+       struct timespec timeout;
+       clock_gettime(CLOCK_REALTIME, &timeout);
+       timeout.tv_sec += _cct->_conf->heartbeat_interval;
+       sem_timedwait(&_sem, &timeout);
+      } else {
+       sem_wait(&_sem);
+      }
       if (_exit_thread) {
        break;
       }