27 using namespace folly;
32 auto f1 = [&]() { count++; };
49 auto f1 = [&]() { count++; };
62 std::chrono::milliseconds dur{10};
76 std::chrono::milliseconds dur{10};
88 std::chrono::milliseconds dur{10};
90 x.
schedule([&] { second =
true; }, 2 * dur);
106 std::chrono::milliseconds dur{10};
124 x.
scheduleAt([&] { count++; }, x.
now() + std::chrono::milliseconds(10));
126 x.
advance(std::chrono::milliseconds(10));
142 x.
advance(std::chrono::microseconds(5));
143 x.
schedule([&] { count++; }, std::chrono::microseconds(6));
152 x.
advance(std::chrono::microseconds(5));
153 x.
schedule([&] { count++; }, std::chrono::microseconds(6));
155 x.
advance(std::chrono::microseconds(-1));
199 x.
advance(std::chrono::milliseconds(10));
245 std::function<void()> fn;
251 f.fn = [&] { counter++; };
259 [](
auto&&) {
throw std::runtime_error(
"Faildog"); });
271 throw std::runtime_error(
"bad");
278 auto f =
folly::via(&x).onError([&](std::runtime_error& e) {
299 auto f =
folly::via(&x).thenValue([](
auto&&) {
return 42; });
#define EXPECT_THROW(statement, expected_exception)
#define EXPECT_EQ(val1, val2)
void scheduleAt(Func &&f, TimePoint const &t) override
constexpr detail::Map< Move > move
std::chrono::steady_clock::time_point now()
void waitFor(F const &f)
makeProgress until this Future is ready.
—— Concurrent Priority Queue Implementation ——
void schedule(Func &&a)
Alias for add() (for Rx consistency)
void advance(Duration const &dur)
#define EXPECT_STREQ(s1, s2)
FOLLY_ALWAYS_INLINE void wait(const WaitOptions &opt=wait_options()) noexcept
void advanceTo(TimePoint const &t)
void add(Func f) override
TimePoint now() override
Get this executor's notion of time. Must be threadsafe.
#define EXPECT_TRUE(condition)
std::atomic< int > counter
auto via(Executor *x, Func &&func) -> Future< typename isFutureOrSemiFuture< decltype(std::declval< Func >()())>::Inner >
void add(Func f) override
#define EXPECT_FALSE(condition)
TEST(SequencedExecutor, CPUThreadPoolExecutor)
Future< typename std::decay< T >::type > makeFuture(T &&t)
constexpr detail::First first