summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Watkins <noahwatkins@gmail.com>2013-07-20 18:41:39 -0700
committerNoah Watkins <noahwatkins@gmail.com>2013-09-17 10:16:19 -0700
commitfad1c383c834217ce04cbd02a665f5ad47fd35f8 (patch)
treea6ca59532a3ad752b2c60016ba9680950a6363d8
parent4670b0f14f009d1f5c19f5c3bce3bd5b9127e14b (diff)
downloadceph-fad1c383c834217ce04cbd02a665f5ad47fd35f8.tar.gz
context: handle platform without sem_timedwait
On OSX sem_timedwait is not available. This patch simply turns off the heartbeat interval feature. Building a replacement should be possible, but is needs some careful thought because pthread mutex/conds aren't thread safe, and sem_post is called from SIGHUP. Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
-rw-r--r--configure.ac1
-rw-r--r--src/common/ceph_context.cc6
2 files changed, 7 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 1eba33d5428..fd6d8679819 100644
--- a/configure.ac
+++ b/configure.ac
@@ -556,6 +556,7 @@ AC_CHECK_HEADERS([sys/disk.h])
AC_CHECK_HEADERS([sys/prctl.h])
AC_CHECK_FUNCS([prctl])
AC_CHECK_FUNCS([posix_fadvise])
+AC_CHECK_FUNCS([sem_timedwait])
# Checks for typedefs, structures, and compiler characteristics.
#AC_HEADER_STDBOOL
diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc
index e694a2f09b3..53f9b4d6803 100644
--- a/src/common/ceph_context.cc
+++ b/src/common/ceph_context.cc
@@ -12,6 +12,8 @@
*
*/
+#include <acconfig.h>
+
#include <time.h>
#include "common/admin_socket.h"
@@ -52,10 +54,14 @@ public:
{
while (1) {
if (_cct->_conf->heartbeat_interval) {
+#ifdef HAVE_SEM_TIMEDWAIT
struct timespec timeout;
clock_gettime(CLOCK_REALTIME, &timeout);
timeout.tv_sec += _cct->_conf->heartbeat_interval;
sem_timedwait(&_sem, &timeout);
+#else
+ sem_wait(&_sem);
+#endif
} else {
sem_wait(&_sem);
}