Commit 322fdec2 authored by Robin Cheng's avatar Robin Cheng Committed by Facebook GitHub Bot

Fix simple race conditions in FunctionSchedulerTest by using atomic.

Summary: This is pretty self-explanatory.

Reviewed By: yfeldblum

Differential Revision: D23514563

fbshipit-source-id: 39b5796c742bfacc830c0154bf72bbd190501e33
parent 7aae308f
......@@ -155,7 +155,7 @@ TEST(FunctionScheduler, AddCancel2) {
// Test a function that schedules another function
atomic<int> adderCount{0};
int fn2Count = 0;
atomic<int> fn2Count = 0;
auto fn2 = [&] { ++fn2Count; };
auto fnAdder = [&] {
++adderCount;
......@@ -286,8 +286,8 @@ TEST(FunctionScheduler, ResetFuncWhileRunning) {
boost::barrier barrier_b{2};
boost::barrier barrier_c{2};
boost::barrier barrier_d{2};
bool set = false;
size_t count = 0;
atomic<bool> set = false;
atomic<size_t> count = 0;
};
State state; // held by ref
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment