Commit c821d129 authored by Andrey Ignatov's avatar Andrey Ignatov Committed by Facebook Github Bot 7

Remove boost::barrier from AsyncUDPSocketTest.

Summary:
`EventBase` has its own methods to wait till it's ready so we can avoid using
barriers and remove boost dependency.

Reviewed By: mzlee

Differential Revision: D3894408

fbshipit-source-id: f050a982c98c4f672cf295845115686c95fc7919
parent 691cd11c
......@@ -20,8 +20,6 @@
#include <folly/io/async/EventBase.h>
#include <folly/SocketAddress.h>
#include <boost/thread/barrier.hpp>
#include <folly/io/IOBuf.h>
#include <folly/portability/GTest.h>
......@@ -110,11 +108,7 @@ class UDPServer {
evb.loopForever();
});
auto r = std::make_shared<boost::barrier>(2);
evb.runInEventBaseThread([r] () {
r->wait();
});
r->wait();
evb.waitUntilRunning();
socket_->addListener(&evb, &acceptors_[i]);
threads_.emplace_back(std::move(t));
......@@ -255,7 +249,6 @@ class UDPClient
TEST(AsyncSocketTest, PingPong) {
folly::EventBase sevb;
UDPServer server(&sevb, folly::SocketAddress("127.0.0.1", 0), 4);
boost::barrier barrier(2);
// Start event loop in a separate thread
auto serverThread = std::thread([&sevb] () {
......@@ -263,12 +256,10 @@ TEST(AsyncSocketTest, PingPong) {
});
// Wait for event loop to start
sevb.runInEventBaseThread([&] () { barrier.wait(); });
barrier.wait();
sevb.waitUntilRunning();
// Start the server
sevb.runInEventBaseThread([&] () { server.start(); barrier.wait(); });
barrier.wait();
sevb.runInEventBaseThreadAndWait([&]() { server.start(); });
folly::EventBase cevb;
UDPClient client(&cevb);
......@@ -279,8 +270,7 @@ TEST(AsyncSocketTest, PingPong) {
});
// Wait for event loop to start
cevb.runInEventBaseThread([&] () { barrier.wait(); });
barrier.wait();
cevb.waitUntilRunning();
// Send ping
cevb.runInEventBaseThread([&] () { client.start(server.address(), 1000); });
......
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