feat/support_fiber #2
@ -7,7 +7,7 @@ namespace fiber {
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
TEST(Fiber, Base) {
|
TEST(Fiber, Base) {
|
||||||
constexpr auto kMaxCnt = 5000;
|
constexpr auto kMaxCnt = 5000000;
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
|
||||||
// 0 -> master fiber
|
// 0 -> master fiber
|
||||||
@ -24,16 +24,14 @@ TEST(Fiber, Base) {
|
|||||||
ASSERT_EQ(Fiber::Current(), fibers[i].get());
|
ASSERT_EQ(Fiber::Current(), fibers[i].get());
|
||||||
++cnt;
|
++cnt;
|
||||||
Fiber::MasterFiber()->Resume();
|
Fiber::MasterFiber()->Resume();
|
||||||
TILE_LOG_INFO("worke cnt: {}", cnt);
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
while (cnt < kMaxCnt) {
|
while (cnt < kMaxCnt) {
|
||||||
int old = cnt;
|
int old = cnt;
|
||||||
auto next_fiber = fibers[Random(1, 1)].get();
|
auto next_fiber = fibers[Random(1, 9)].get();
|
||||||
|
|
||||||
TILE_LOG_INFO("cnt: {}", cnt);
|
|
||||||
next_fiber->Resume();
|
next_fiber->Resume();
|
||||||
ASSERT_EQ(old + 1, cnt);
|
ASSERT_EQ(old + 1, cnt);
|
||||||
ASSERT_EQ(Fiber::Current(), Fiber::MasterFiber());
|
ASSERT_EQ(Fiber::Current(), Fiber::MasterFiber());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user