diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-03-11 20:15:10 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-03-11 20:15:10 +0200 |
commit | dfd0e9c97d80c5cd7115d6cbb49cce08168071b6 (patch) | |
tree | 7bb5c56c18c83f3180101e310198cb3e3fdf1ab7 /contrib/epee | |
parent | Merge pull request #711 (diff) | |
parent | Need to link boost::chrono in more places now (diff) | |
download | monero-dfd0e9c97d80c5cd7115d6cbb49cce08168071b6.tar.xz |
Merge pull request #712
66c2fc7 Need to link boost::chrono in more places now (Howard Chu)
b937a2c Use boost::thread instead of std::thread (Howard Chu)
Diffstat (limited to 'contrib/epee')
-rw-r--r-- | contrib/epee/include/console_handler.h | 16 | ||||
-rw-r--r-- | contrib/epee/include/net/abstract_tcp_server2.h | 6 | ||||
-rw-r--r-- | contrib/epee/include/net/abstract_tcp_server2.inl | 4 | ||||
-rw-r--r-- | contrib/epee/include/syncobj.h | 12 |
4 files changed, 19 insertions, 19 deletions
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<std::mutex> lock(m_response_mutex); + boost::unique_lock<boost::mutex> 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<std::mutex> lock(m_request_mutex); + boost::unique_lock<boost::mutex> 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<std::mutex> lock(m_request_mutex); + boost::unique_lock<boost::mutex> 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<std::mutex> lock(m_response_mutex); + boost::unique_lock<boost::mutex> 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<std::pair<boost::system_time, connection_ptr>> 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 <boost/utility/value_init.hpp> #include <boost/asio/deadline_timer.hpp> #include <boost/date_time/posix_time/posix_time.hpp> // TODO -#include <boost/thread/thread.hpp> // TODO +#include <boost/thread/v2/thread.hpp> // 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 <boost/chrono/duration.hpp> #include <boost/thread/locks.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/recursive_mutex.hpp> -#include <thread> -#include <chrono> +#include <boost/thread/v2/thread.hpp> 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<decltype(x)> 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<decltype(x)> 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<decltype(x)> 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<decltype(x)> 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<decltype(x)> 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<decltype(x)> 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<decltype(x)> 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<decltype(x)> critical_region_var1(x) #define CRITICAL_REGION_END() } |