feat/support_fiber #6

Merged
tqcq merged 52 commits from feat/support_fiber into master 2024-08-11 13:03:04 +08:00
2 changed files with 4 additions and 12 deletions
Showing only changes of commit e8104ca460 - Show all commits

View File

@ -85,7 +85,6 @@ TEST_F(CondVarTest, NotifyOne_Wait) {
TEST_F(CondVarTest, NotifyOne_WaitFor) { TEST_F(CondVarTest, NotifyOne_WaitFor) {
// Wait // Wait
// constexpr auto kWaitTimeoutMs = 100; // constexpr auto kWaitTimeoutMs = 100;
auto start = ReadSteadyClock();
constexpr auto kWaitTimeout = std::chrono::milliseconds(50); constexpr auto kWaitTimeout = std::chrono::milliseconds(50);
auto WaitFor = [&] { auto WaitFor = [&] {
UniqueLock<Mutex> inner_locker(*m); UniqueLock<Mutex> inner_locker(*m);
@ -110,16 +109,9 @@ TEST_F(CondVarTest, NotifyOne_WaitFor) {
cv->NotifyOne(); cv->NotifyOne();
} }
auto now = ReadSteadyClock();
worker->join(); worker->join();
if (now - start > kWaitTimeout) { ASSERT_FALSE(is_timeout);
// timeout ASSERT_TRUE(is_set);
ASSERT_TRUE(is_timeout);
ASSERT_FALSE(is_set);
} else {
ASSERT_FALSE(is_timeout);
ASSERT_TRUE(is_set);
}
} }
// timeout // timeout

View File

@ -249,8 +249,8 @@ TEST(ScopedLock, TryLock) {
} }
TEST(ScopedLock, MultiThread) { TEST(ScopedLock, MultiThread) {
constexpr std::size_t kThreadCount = 5; constexpr std::size_t kThreadCount = 4;
constexpr std::size_t kLoopCount = 10000; constexpr std::size_t kLoopCount = 1000;
int x = 0; int x = 0;
Mutex m; Mutex m;