Skip to content

Commit 1e84b97

Browse files
committed
Use CLOCK_MONOTONIC by default
- Eliminated BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC. - CLOCK_MONOTONIC is now always used whenever it is available.
1 parent a0f216b commit 1e84b97

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

include/boost/thread/detail/config.hpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -409,25 +409,21 @@
409409
# endif
410410
#endif
411411

412-
#if defined(BOOST_THREAD_PLATFORM_WIN32)
412+
#if defined(BOOST_THREAD_CHRONO_WINDOWS_API)
413413
#define BOOST_THREAD_HAS_MONO_CLOCK
414414
#define BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
415-
#elif defined(BOOST_THREAD_MACOS)
415+
#elif defined(BOOST_THREAD_CHRONO_MAC_API)
416416
#define BOOST_THREAD_HAS_MONO_CLOCK
417417
#else
418418
#include <time.h> // check for CLOCK_MONOTONIC
419419
#if defined(CLOCK_MONOTONIC)
420420
#define BOOST_THREAD_HAS_MONO_CLOCK
421-
#if defined(BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC)
422-
#define BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
423-
#endif
424-
#else
425-
#undef BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC
421+
#define BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
426422
#endif
427423
#endif
428424

429425
#if defined(BOOST_THREAD_PLATFORM_WIN32)
430-
#elif ! defined BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC
426+
#elif ! defined BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
431427
#if defined BOOST_PTHREAD_HAS_TIMEDLOCK
432428
#define BOOST_THREAD_USES_PTHREAD_TIMEDLOCK
433429
#elif (defined(_POSIX_TIMEOUTS) && (_POSIX_TIMEOUTS-0)>=200112L) \

include/boost/thread/pthread/pthread_helpers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace boost
1818
{
1919
inline int cond_init(pthread_cond_t& cond) {
2020

21-
#ifdef BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC
21+
#ifdef BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
2222
pthread_condattr_t attr;
2323
int res = pthread_condattr_init(&attr);
2424
if (res)

test/test_12949.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
55

66
#define BOOST_THREAD_VERSION 4
7-
//#define BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC
87

98
//#include <boost/thread/thread.hpp>
109
#include <boost/thread/condition_variable.hpp>

0 commit comments

Comments
 (0)