]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_context: check internal heartbeat in cct service thread
authorSage Weil <sage@newdream.net>
Thu, 28 Jul 2011 16:39:15 +0000 (09:39 -0700)
committerSage Weil <sage@newdream.net>
Thu, 28 Jul 2011 16:49:23 +0000 (09:49 -0700)
Signed-off-by: Sage Weil <sage@newdream.net>
src/Makefile.am
src/common/ceph_context.cc

index e1f47c1eaf99e54de25ec85aedfed236396650cc..3688f66c5e73505847b262acf05ca3ef194c9147 100644 (file)
@@ -17,7 +17,7 @@ check_PROGRAMS =
 TESTS = $(check_PROGRAMS)
 
 
-EXTRALIBS =
+EXTRALIBS = -lrt
 if WITH_PROFILER
 EXTRALIBS += -lprofiler
 endif
index 8083792cedb787fd00b8bacd93c3e6ddee7944e9..4b3b0685c43415912162bb6f0ac25617fb34a274 100644 (file)
@@ -12,6 +12,8 @@
  *
  */
 
+#include <time.h>
+
 #include "common/admin_socket.h"
 #include "common/DoutStreambuf.h"
 #include "common/perf_counters.h"
@@ -44,7 +46,11 @@ public:
   void *entry()
   {
     while (1) {
-      sem_wait(&_sem);
+      struct timespec timeout;
+      clock_gettime(CLOCK_REALTIME, &timeout);
+      timeout.tv_sec += _cct->_conf->heartbeat_interval;
+
+      sem_timedwait(&_sem, &timeout);
       if (_exit_thread) {
        break;
       }
@@ -52,6 +58,7 @@ public:
        _cct->_doss->reopen_logs(_cct->_conf);
        _reopen_logs = false;
       }
+      _cct->_heartbeat_map->check_touch_file();
     }
     return NULL;
   }