id summary reporter owner description type status milestone component version severity resolution keywords cc 12949 using sleep_for in a thread context without including boost/thread/thread.hpp yields incorrect behaviour when BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC is defined rkaris@… viboes "When defining a function f() in a compilation unit which uses boost::thread::sleep_for() which does not include , but another boost thread header, function.h {{{ #ifndef FUNCTION_H #define FUNCTION_H void f(); #endif }}} function.cpp: {{{ #define BOOST_THREAD_VERSION 4 #define BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC #include #include ""function.h"" void f() { boost::this_thread::sleep_for(boost::chrono::milliseconds(10)); } }}} and defining a compilation unit which uses this function in a thread context, main.cpp: {{{ #define BOOST_THREAD_VERSION 4 #define BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC #include ""function.h"" #include int main() { auto t = boost::thread([] { f(); }); t.join(); return 0; } }}} the sleep_for() waits much long than expected when a monotonic clock is used. This has been tested with both boost versions 1.63.0 and 1.64.0 beta2." Bugs closed Boost 1.66.0 thread Boost 1.63.0 Problem fixed