24 explicit Foo(std::atomic<int>& d) :
data(d) {}
30 runner_.add(
"Foo", [
this]() {
32 return std::chrono::seconds(0);
48 runner_.add(
"FooLongSleep", [
this]() {
58 TEST(TestThreadedRepeatingFunctionRunner, HandleBackgroundLoop) {
59 std::atomic<int>
data(0);
64 while (data.load() == 0) {
65 this_thread::sleep_for(chrono::milliseconds(10));
69 auto prev_val = data.load();
70 this_thread::sleep_for(chrono::milliseconds(100));
74 TEST(TestThreadedRepeatingFunctionRunner, HandleLongSleepingThread) {
75 std::atomic<int>
data(0);
80 while (data.load() == 0) {
81 this_thread::sleep_for(chrono::milliseconds(10));
Foo(std::atomic< int > &d)
std::atomic< int > & data
FooLongSleep(std::atomic< int > &d)
#define EXPECT_EQ(val1, val2)
folly::ThreadedRepeatingFunctionRunner runner_
folly::ThreadedRepeatingFunctionRunner runner_
TEST(TestThreadedRepeatingFunctionRunner, HandleBackgroundLoop)
std::atomic< int > & data
static constexpr uint64_t data[1]