aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests/epee_boosted_tcp_server.cpp
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2017-02-12 17:53:13 -0500
committerLee Clagett <code@leeclagett.com>2017-02-16 20:10:23 -0500
commit2cde2c02ca0e2bf1dc6f8fa78cd830f5989f9cea (patch)
treee0fb13b6e69c139e0cdf4557bc9fa99b7d492d81 /tests/unit_tests/epee_boosted_tcp_server.cpp
parentMerge pull request #1719 (diff)
downloadmonero-2cde2c02ca0e2bf1dc6f8fa78cd830f5989f9cea.tar.xz
switch to boost::thread for mingw build
Diffstat (limited to 'tests/unit_tests/epee_boosted_tcp_server.cpp')
-rw-r--r--tests/unit_tests/epee_boosted_tcp_server.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/tests/unit_tests/epee_boosted_tcp_server.cpp b/tests/unit_tests/epee_boosted_tcp_server.cpp
index 946db292d..261d81f84 100644
--- a/tests/unit_tests/epee_boosted_tcp_server.cpp
+++ b/tests/unit_tests/epee_boosted_tcp_server.cpp
@@ -28,10 +28,9 @@
//
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
-#include <condition_variable>
-#include <chrono>
-#include <mutex>
-#include <thread>
+#include <boost/chrono/chrono.hpp>
+#include <boost/thread/condition_variable.hpp>
+#include <boost/thread/mutex.hpp>
#include "gtest/gtest.h"
@@ -88,13 +87,13 @@ TEST(boosted_tcp_server, worker_threads_are_exception_resistant)
test_tcp_server srv(epee::net_utils::e_connection_type_RPC); // RPC disables network limit for unit tests
ASSERT_TRUE(srv.init_server(test_server_port, test_server_host));
- std::mutex mtx;
- std::condition_variable cond;
+ boost::mutex mtx;
+ boost::condition_variable cond;
int counter = 0;
auto counter_incrementer = [&counter, &cond, &mtx]()
{
- std::unique_lock<std::mutex> lock(mtx);
+ boost::unique_lock<boost::mutex> lock(mtx);
++counter;
if (4 <= counter)
{
@@ -110,8 +109,8 @@ TEST(boosted_tcp_server, worker_threads_are_exception_resistant)
ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw 4; }));
{
- std::unique_lock<std::mutex> lock(mtx);
- ASSERT_NE(std::cv_status::timeout, cond.wait_for(lock, std::chrono::seconds(5)));
+ boost::unique_lock<boost::mutex> lock(mtx);
+ ASSERT_NE(boost::cv_status::timeout, cond.wait_for(lock, boost::chrono::seconds(5)));
ASSERT_EQ(4, counter);
}
@@ -124,8 +123,8 @@ TEST(boosted_tcp_server, worker_threads_are_exception_resistant)
ASSERT_TRUE(srv.async_call(counter_incrementer));
{
- std::unique_lock<std::mutex> lock(mtx);
- ASSERT_NE(std::cv_status::timeout, cond.wait_for(lock, std::chrono::seconds(5)));
+ boost::unique_lock<boost::mutex> lock(mtx);
+ ASSERT_NE(boost::cv_status::timeout, cond.wait_for(lock, boost::chrono::seconds(5)));
ASSERT_EQ(4, counter);
}