X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2Fio%2Fasync%2Ftest%2FEventBaseTest.cpp;h=f94ebfc4d584736a663e51bdd8cbc770100a116e;hp=255054998223b82dfac0b7d5bf309a54bf72ec18;hb=bb4612a0129615428e65400898cce618cd89eb1a;hpb=0234d5d11585e5e1a3c76a7ea5e99c3d925a06ca diff --git a/folly/io/async/test/EventBaseTest.cpp b/folly/io/async/test/EventBaseTest.cpp index 25505499..f94ebfc4 100644 --- a/folly/io/async/test/EventBaseTest.cpp +++ b/folly/io/async/test/EventBaseTest.cpp @@ -16,6 +16,8 @@ * specific language governing permissions and limitations * under the License. */ +#include + #include #include #include @@ -32,6 +34,7 @@ using std::atomic; using std::deque; using std::pair; using std::vector; +using std::unique_ptr; using std::thread; using std::make_pair; using std::cerr; @@ -1179,14 +1182,14 @@ TEST(EventBaseTest, RunInThread) { // whether any of the race conditions happened. TEST(EventBaseTest, RunInEventLoopThreadAndWait) { const size_t c = 256; - vector> atoms(c); + vector>> atoms(c); for (size_t i = 0; i < c; ++i) { auto& atom = atoms.at(i); - atom = 0; + atom = make_unique>(0); } vector threads(c); for (size_t i = 0; i < c; ++i) { - auto& atom = atoms.at(i); + auto& atom = *atoms.at(i); auto& th = threads.at(i); th = thread([&atom] { EventBase eb; @@ -1209,7 +1212,7 @@ TEST(EventBaseTest, RunInEventLoopThreadAndWait) { th.join(); } size_t sum = 0; - for (auto& atom : atoms) sum += atom; + for (auto& atom : atoms) sum += *atom; EXPECT_EQ(c, sum); }