summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Watkins <noahwatkins@gmail.com>2013-07-20 18:41:39 -0700
committerNoah Watkins <noahwatkins@gmail.com>2013-07-20 18:41:39 -0700
commit842b45c4aef560483936cdf96b9ed8e0c0938821 (patch)
tree59d74761fb35153f55456b55c0351268a0f1d163
parente3a19d036e0acbd53feca97f20096c6fd7507125 (diff)
downloadceph-842b45c4aef560483936cdf96b9ed8e0c0938821.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 b9b45b0dc41..984a49014ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -542,6 +542,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 cad980bb2a6..7d1b74ebd43 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"
@@ -51,10 +53,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);
}