mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge #16117: util: Replace boost sleep with std sleep
fae86c38bcutil: Remove unused MilliSleep (MarcoFalke)fa9af06d91scripted-diff: Replace MilliSleep with UninterruptibleSleep (MarcoFalke)fa4620be78util: Add UnintrruptibleSleep (MarcoFalke) Pull request description: We don't use the interruptible feature of boost's sleep anywhere, so replace it with the sleep in `std::thread` ACKs for top commit: ajtowns: ACKfae86c38bcquick code review practicalswift: ACKfae86c38bc-- patch looks correct sipa: Concept and code review ACKfae86c38bcfanquake: ACKfae86c38bc- note that an instance of `DHAVE_WORKING_BOOST_SLEEP_FOR` was missed in the [linter](https://github.com/bitcoin/bitcoin/blob/master/test/lint/extended-lint-cppcheck.sh#L69), but that can be cleaned up later. Tree-SHA512: 7c0f8eb197664b9f7d9fe6c472c77d384f11c797c913afc31de4b532e3b4fd9ea6dd174f92062ff9d1ec39b25e0900ca7c597435add87f0f2477d9557204848c
This commit is contained in:
51
configure.ac
51
configure.ac
@@ -1244,57 +1244,6 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
LIBS="$TEMP_LIBS"
|
||||
CPPFLAGS="$TEMP_CPPFLAGS"
|
||||
|
||||
dnl Boost >= 1.50 uses sleep_for rather than the now-deprecated sleep, however
|
||||
dnl it was broken from 1.50 to 1.52 when backed by nanosleep. Use sleep_for if
|
||||
dnl a working version is available, else fall back to sleep. sleep was removed
|
||||
dnl after 1.56.
|
||||
dnl If neither is available, abort.
|
||||
TEMP_LIBS="$LIBS"
|
||||
LIBS="$BOOST_LIBS $LIBS"
|
||||
TEMP_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <boost/version.hpp>
|
||||
]],[[
|
||||
#if BOOST_VERSION >= 105000 && (!defined(BOOST_HAS_NANOSLEEP) || BOOST_VERSION >= 105200)
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(0));
|
||||
#else
|
||||
choke me
|
||||
#endif
|
||||
]])],
|
||||
[boost_sleep=yes;
|
||||
AC_DEFINE(HAVE_WORKING_BOOST_SLEEP_FOR, 1, [Define this symbol if boost sleep_for works])],
|
||||
[boost_sleep=no])
|
||||
LIBS="$TEMP_LIBS"
|
||||
CPPFLAGS="$TEMP_CPPFLAGS"
|
||||
|
||||
if test x$boost_sleep != xyes; then
|
||||
TEMP_LIBS="$LIBS"
|
||||
LIBS="$BOOST_LIBS $LIBS"
|
||||
TEMP_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
]],[[
|
||||
#if BOOST_VERSION <= 105600
|
||||
boost::this_thread::sleep(boost::posix_time::milliseconds(0));
|
||||
#else
|
||||
choke me
|
||||
#endif
|
||||
]])],
|
||||
[boost_sleep=yes; AC_DEFINE(HAVE_WORKING_BOOST_SLEEP, 1, [Define this symbol if boost sleep works])],
|
||||
[boost_sleep=no])
|
||||
LIBS="$TEMP_LIBS"
|
||||
CPPFLAGS="$TEMP_CPPFLAGS"
|
||||
fi
|
||||
|
||||
if test x$boost_sleep != xyes; then
|
||||
AC_MSG_ERROR(No working boost sleep implementation found.)
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if test x$use_pkgconfig = xyes; then
|
||||
|
||||
Reference in New Issue
Block a user