feat use atomic
All checks were successful
ci/pr/linux-aarch64-gcc/1 Pipeline was successful
ci/pr/linux-aarch64-gcc/2 Pipeline was successful
ci/pr/linux-x64-gcc/1 Pipeline was successful
ci/pr/linux-x64-gcc/2 Pipeline was successful
ci/pull_request_closed/linux-aarch64-gcc/1 Pipeline was successful
ci/pull_request_closed/linux-aarch64-gcc/2 Pipeline was successful
ci/pull_request_closed/linux-x64-gcc/1 Pipeline was successful
ci/pull_request_closed/linux-x64-gcc/2 Pipeline was successful
ci/push/linux-aarch64-gcc/1 Pipeline was successful
ci/push/linux-aarch64-gcc/2 Pipeline was successful
ci/push/linux-x64-gcc/1 Pipeline was successful
ci/push/linux-x64-gcc/2 Pipeline was successful
All checks were successful
ci/pr/linux-aarch64-gcc/1 Pipeline was successful
ci/pr/linux-aarch64-gcc/2 Pipeline was successful
ci/pr/linux-x64-gcc/1 Pipeline was successful
ci/pr/linux-x64-gcc/2 Pipeline was successful
ci/pull_request_closed/linux-aarch64-gcc/1 Pipeline was successful
ci/pull_request_closed/linux-aarch64-gcc/2 Pipeline was successful
ci/pull_request_closed/linux-x64-gcc/1 Pipeline was successful
ci/pull_request_closed/linux-x64-gcc/2 Pipeline was successful
ci/push/linux-aarch64-gcc/1 Pipeline was successful
ci/push/linux-aarch64-gcc/2 Pipeline was successful
ci/push/linux-x64-gcc/1 Pipeline was successful
ci/push/linux-x64-gcc/2 Pipeline was successful
This commit is contained in:
parent
9830a33ea9
commit
9bad174e0e
@ -51,7 +51,7 @@ protected:
|
||||
protected:
|
||||
Mutex *m;
|
||||
CondVar *cv;
|
||||
bool is_started;
|
||||
std::atomic<bool> is_started;
|
||||
bool is_set;
|
||||
bool is_timeout;
|
||||
std::thread *worker;
|
||||
@ -64,11 +64,13 @@ TEST_F(CondVarTest, NotifyOne_Wait) {
|
||||
// UniqueLock<Mutex> inner_locker(*m);
|
||||
// cv->Wait(inner_locker);
|
||||
ScopedLock inner_locker(*m);
|
||||
SetStarted();
|
||||
cv->Wait(inner_locker);
|
||||
is_set = true;
|
||||
cv->NotifyOne();
|
||||
});
|
||||
|
||||
WaitStarted();
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
ASSERT_FALSE(is_set);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user