From b937a2c915861900d047d4d4a24af31c454e3540 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 11 Mar 2016 12:25:28 +0000 Subject: Use boost::thread instead of std::thread and all other associated IPC --- contrib/epee/include/console_handler.h | 16 ++++++++-------- contrib/epee/include/net/abstract_tcp_server2.h | 6 +++--- contrib/epee/include/net/abstract_tcp_server2.inl | 4 ++-- contrib/epee/include/syncobj.h | 12 ++++++------ 4 files changed, 19 insertions(+), 19 deletions(-) (limited to 'contrib/epee') diff --git a/contrib/epee/include/console_handler.h b/contrib/epee/include/console_handler.h index d76d7930c..95b986ff5 100644 --- a/contrib/epee/include/console_handler.h +++ b/contrib/epee/include/console_handler.h @@ -65,7 +65,7 @@ namespace epee if (state_eos == m_read_status) return false; - std::unique_lock lock(m_response_mutex); + boost::unique_lock lock(m_response_mutex); while (state_init == m_read_status) { m_response_cv.wait(lock); @@ -104,7 +104,7 @@ namespace epee private: bool start_read() { - std::unique_lock lock(m_request_mutex); + boost::unique_lock lock(m_request_mutex); if (!m_run.load(std::memory_order_relaxed) || m_has_read_request) return false; @@ -115,7 +115,7 @@ namespace epee bool wait_read() { - std::unique_lock lock(m_request_mutex); + boost::unique_lock lock(m_request_mutex); while (m_run.load(std::memory_order_relaxed) && !m_has_read_request) { m_request_cv.wait(lock); @@ -188,7 +188,7 @@ namespace epee } else { - std::unique_lock lock(m_response_mutex); + boost::unique_lock lock(m_response_mutex); if (m_run.load(std::memory_order_relaxed)) { m_line = std::move(line); @@ -220,10 +220,10 @@ namespace epee bool m_has_read_request; t_state m_read_status; - std::mutex m_request_mutex; - std::mutex m_response_mutex; - std::condition_variable m_request_cv; - std::condition_variable m_response_cv; + boost::mutex m_request_mutex; + boost::mutex m_response_mutex; + boost::condition_variable m_request_cv; + boost::condition_variable m_response_cv; }; diff --git a/contrib/epee/include/net/abstract_tcp_server2.h b/contrib/epee/include/net/abstract_tcp_server2.h index f3dd7291c..80f3f6db0 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.h +++ b/contrib/epee/include/net/abstract_tcp_server2.h @@ -153,8 +153,8 @@ namespace net_utils // for calculate speed (last 60 sec) network_throttle m_throttle_speed_in; network_throttle m_throttle_speed_out; - std::mutex m_throttle_speed_in_mutex; - std::mutex m_throttle_speed_out_mutex; + boost::mutex m_throttle_speed_in_mutex; + boost::mutex m_throttle_speed_out_mutex; public: void setRpcStation(); @@ -307,7 +307,7 @@ namespace net_utils /// The next connection to be accepted connection_ptr new_connection_; - std::mutex connections_mutex; + boost::mutex connections_mutex; std::deque> connections_; }; // class <>boosted_tcp_server diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 4fb6fa75d..698e1947a 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -41,7 +41,7 @@ #include #include #include // TODO -#include // TODO +#include // TODO #include "misc_language.h" #include "pragma_comp_defs.h" @@ -294,7 +294,7 @@ PRAGMA_WARNING_DISABLE_VS(4355) if (delay > 0) { long int ms = (long int)(delay * 100); epee::net_utils::data_logger::get_instance().add_data("sleep_down", ms); - std::this_thread::sleep_for(std::chrono::milliseconds(ms)); + boost::this_thread::sleep_for(boost::chrono::milliseconds(ms)); } } while(delay > 0); } // any form of sleeping diff --git a/contrib/epee/include/syncobj.h b/contrib/epee/include/syncobj.h index 0833b4114..8912fc018 100644 --- a/contrib/epee/include/syncobj.h +++ b/contrib/epee/include/syncobj.h @@ -30,11 +30,11 @@ #ifndef __WINH_OBJ_H__ #define __WINH_OBJ_H__ +#include #include #include #include -#include -#include +#include namespace epee { @@ -224,10 +224,10 @@ namespace epee #define SHARED_CRITICAL_REGION_BEGIN(x) { shared_guard critical_region_var(x) #define EXCLUSIVE_CRITICAL_REGION_BEGIN(x) { exclusive_guard critical_region_var(x) -#define CRITICAL_REGION_LOCAL(x) {std::this_thread::sleep_for(std::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep()));} epee::critical_region_t critical_region_var(x) -#define CRITICAL_REGION_BEGIN(x) { std::this_thread::sleep_for(std::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep())); epee::critical_region_t critical_region_var(x) -#define CRITICAL_REGION_LOCAL1(x) {std::this_thread::sleep_for(std::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep()));} epee::critical_region_t critical_region_var1(x) -#define CRITICAL_REGION_BEGIN1(x) { std::this_thread::sleep_for(std::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep())); epee::critical_region_t critical_region_var1(x) +#define CRITICAL_REGION_LOCAL(x) {boost::this_thread::sleep_for(boost::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep()));} epee::critical_region_t critical_region_var(x) +#define CRITICAL_REGION_BEGIN(x) { boost::this_thread::sleep_for(boost::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep())); epee::critical_region_t critical_region_var(x) +#define CRITICAL_REGION_LOCAL1(x) {boost::this_thread::sleep_for(boost::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep()));} epee::critical_region_t critical_region_var1(x) +#define CRITICAL_REGION_BEGIN1(x) { boost::this_thread::sleep_for(boost::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep())); epee::critical_region_t critical_region_var1(x) #define CRITICAL_REGION_END() } -- cgit v1.2.3