提交 230e6872 编写于 作者: V Venkatesh Radhakrishnan

Fix TSAN failue in env_test

Summary: Check for state of task before deleting it.

Test Plan: Run env_test with TSAN

Reviewers: igor, sdong

Reviewed By: sdong

Subscribers: meyering, dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D35283
上级 155d468c
......@@ -120,8 +120,15 @@ TEST_F(EnvPosixTest, UnSchedule) {
/* Schedule another task */
env_->Schedule(&SetBool, &called);
Env::Default()->SleepForMicroseconds(kDelayMicros);
for (int i = 0; i < kDelayMicros; i++) {
if (called.load(std::memory_order_relaxed)) {
break;
}
Env::Default()->SleepForMicroseconds(1);
}
ASSERT_TRUE(called.load(std::memory_order_relaxed));
ASSERT_TRUE(!sleeping_task.IsSleeping() && !sleeping_task1.IsSleeping());
}
TEST_F(EnvPosixTest, RunMany) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册