mirror of
https://github.com/monero-project/monero.git
synced 2025-05-06 14:44:59 -04:00
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)
This commit is contained in:
commit
dfd0e9c97d
30 changed files with 110 additions and 103 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue