aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests/epee_boosted_tcp_server.cpp
diff options
context:
space:
mode:
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);
}