feat/support_fiber #6

Merged
tqcq merged 52 commits from feat/support_fiber into master 2024-08-11 13:03:04 +08:00
Showing only changes of commit 9bad174e0e - Show all commits

View File

@ -51,7 +51,7 @@ protected:
protected: protected:
Mutex *m; Mutex *m;
CondVar *cv; CondVar *cv;
bool is_started; std::atomic<bool> is_started;
bool is_set; bool is_set;
bool is_timeout; bool is_timeout;
std::thread *worker; std::thread *worker;
@ -64,11 +64,13 @@ TEST_F(CondVarTest, NotifyOne_Wait) {
// UniqueLock<Mutex> inner_locker(*m); // UniqueLock<Mutex> inner_locker(*m);
// cv->Wait(inner_locker); // cv->Wait(inner_locker);
ScopedLock inner_locker(*m); ScopedLock inner_locker(*m);
SetStarted();
cv->Wait(inner_locker); cv->Wait(inner_locker);
is_set = true; is_set = true;
cv->NotifyOne(); cv->NotifyOne();
}); });
WaitStarted();
std::this_thread::sleep_for(std::chrono::milliseconds(50)); std::this_thread::sleep_for(std::chrono::milliseconds(50));
ASSERT_FALSE(is_set); ASSERT_FALSE(is_set);