Summary:
- Some installations of libstdc++ don't have this defined. This happens
if they were built without --enable-libstdcxx-time. Detect this and
avoid tests that rely on this behavior.
Test Plan:
- fbconfig -r folly && fbmake runtests
- ./configure && make check on Ubuntu/FC/Mac
Reviewed By: meyering@fb.com
FB internal diff:
D1002963
AC_DEFINE([OVERRIDE], [],
[Define to "override" if the compiler supports C++11 "override"])]
)
+
+AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE[
+ #include <thread>
+ #include <chrono>
+ void func() { std::this_thread::sleep_for(std::chrono::seconds(1)); }]],
+ [AC_DEFINE([HAVE_STD__THIS_THREAD__SLEEP_FOR], [1],
+ [Define to 1 if std::this_thread::sleep_for() is defined.])])
+
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE[
#include <type_traits>
} // namespace
+#if FOLLY_HAVE_STD__THIS_THREAD__SLEEP_FOR
TEST(ThreadLocal, Stress) {
constexpr size_t numFillObjects = 250;
std::array<ThreadLocalPtr<FillObject>, numFillObjects> objects;
EXPECT_EQ(numFillObjects * numThreads * numReps, gDestroyed);
}
+#endif
// Yes, threads and fork don't mix
// (http://cppwisdom.quora.com/Why-threads-and-fork-dont-mix) but if you're