mirror of
https://github.com/deepseek-ai/3FS
synced 2025-06-26 18:16:45 +00:00
Initial commit
This commit is contained in:
29
tests/common/folly/TestEventBase.cc
Normal file
29
tests/common/folly/TestEventBase.cc
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <chrono>
|
||||
#include <folly/experimental/coro/BlockingWait.h>
|
||||
#include <folly/experimental/coro/Collect.h>
|
||||
#include <folly/experimental/coro/CurrentExecutor.h>
|
||||
#include <folly/experimental/coro/FutureUtil.h>
|
||||
#include <folly/experimental/coro/Invoke.h>
|
||||
#include <folly/experimental/coro/Promise.h>
|
||||
#include <folly/io/async/EventBase.h>
|
||||
#include <folly/portability/GTest.h>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
TEST(TestEventBase, Normal) {
|
||||
folly::EventBase evb;
|
||||
bool finished = false;
|
||||
|
||||
folly::coro::co_invoke([&]() -> folly::coro::Task<void> {
|
||||
auto executor = co_await folly::coro::co_current_executor;
|
||||
EXPECT_EQ(executor, &evb);
|
||||
finished = true;
|
||||
evb.terminateLoopSoon();
|
||||
co_return;
|
||||
})
|
||||
.scheduleOn(&evb)
|
||||
.start();
|
||||
|
||||
evb.loopForever();
|
||||
ASSERT_TRUE(finished);
|
||||
}
|
||||
Reference in New Issue
Block a user