CMake: check for timed pthreads functions

The macros
  HAVE_PTHREAD_MUTEX_TIMEDLOCK
  HAVE_PTHREAD_COND_TIMEDWAIT
are still being used in the Pthreads threading implementation, but the
CMake build system never sets them, so the timed versions aren't used.
This ended up making WorkerThread heartbeats not beat. </3
This commit is contained in:
Devin J. Pohly
2016-05-24 11:52:45 -04:00
parent 2b6768aed9
commit 40dc05e4ed
2 changed files with 9 additions and 0 deletions
+3
View File
@@ -231,6 +231,9 @@ find_package(Iconv)
find_package(Threads)
if (${Threads_FOUND})
set(HAS_PTHREAD TRUE)
list(APPEND CMAKE_REQUIRED_LIBRARIES pthread)
check_symbol_exists(pthread_mutex_timedlock pthread.h HAVE_PTHREAD_MUTEX_TIMEDLOCK)
check_symbol_exists(pthread_cond_timedwait pthread.h HAVE_PTHREAD_COND_TIMEDWAIT)
else()
set(HAS_PTHREAD FALSE)
endif()
+6
View File
@@ -93,6 +93,12 @@
/* Defined to 1 if the underlying system provides the posix_fadvise function. */
#cmakedefine HAVE_POSIX_FADVISE 1
/* Defined to 1 if the underlying system provides the pthread_mutex_timedlock function. */
#cmakedefine HAVE_PTHREAD_MUTEX_TIMEDLOCK 1
/* Defined to 1 if the underlying system provides the pthread_cond_timedwait function. */
#cmakedefine HAVE_PTHREAD_MUTEX_TIMEDWAIT 1
/* Provide a fallback if intptr_t is not defined. */
#cmakedefine HAVE_SIZEOF_INTPTR_T 1
#if !defined(HAVE_SIZEOF_INTPTR_T)