Skip to content

Commit

Permalink
Use CLOCK_MONOTONIC by default
Browse files Browse the repository at this point in the history
- Eliminated BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC.
- CLOCK_MONOTONIC is now always used whenever it is available.
  • Loading branch information
austin-beer committed Oct 26, 2017
1 parent a0f216b commit 1e84b97
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
12 changes: 4 additions & 8 deletions include/boost/thread/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,25 +409,21 @@
# endif
#endif

#if defined(BOOST_THREAD_PLATFORM_WIN32)
#if defined(BOOST_THREAD_CHRONO_WINDOWS_API)
#define BOOST_THREAD_HAS_MONO_CLOCK
#define BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
#elif defined(BOOST_THREAD_MACOS)
#elif defined(BOOST_THREAD_CHRONO_MAC_API)
#define BOOST_THREAD_HAS_MONO_CLOCK
#else
#include <time.h> // check for CLOCK_MONOTONIC
#if defined(CLOCK_MONOTONIC)
#define BOOST_THREAD_HAS_MONO_CLOCK
#if defined(BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC)
#define BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
#endif
#else
#undef BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC
#define BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
#endif
#endif

#if defined(BOOST_THREAD_PLATFORM_WIN32)
#elif ! defined BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC
#elif ! defined BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
#if defined BOOST_PTHREAD_HAS_TIMEDLOCK
#define BOOST_THREAD_USES_PTHREAD_TIMEDLOCK
#elif (defined(_POSIX_TIMEOUTS) && (_POSIX_TIMEOUTS-0)>=200112L) \
Expand Down
2 changes: 1 addition & 1 deletion include/boost/thread/pthread/pthread_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace boost
{
inline int cond_init(pthread_cond_t& cond) {

#ifdef BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC
#ifdef BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
pthread_condattr_t attr;
int res = pthread_condattr_init(&attr);
if (res)
Expand Down
1 change: 0 additions & 1 deletion test/test_12949.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#define BOOST_THREAD_VERSION 4
//#define BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC

//#include <boost/thread/thread.hpp>
#include <boost/thread/condition_variable.hpp>
Expand Down

0 comments on commit 1e84b97

Please sign in to comment.