aboutsummaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authorHoward Chu <hyc@symas.com>2016-03-11 12:25:28 +0000
committerHoward Chu <hyc@symas.com>2016-03-11 15:09:50 +0000
commitb937a2c915861900d047d4d4a24af31c454e3540 (patch)
treeceedf9b256b9769f72cb34319e4144ae127543dc /src/crypto
parentMerge pull request #705 (diff)
downloadmonero-b937a2c915861900d047d4d4a24af31c454e3540.tar.xz
Use boost::thread instead of std::thread
and all other associated IPC
Diffstat (limited to '')
-rw-r--r--src/crypto/crypto.cpp13
-rw-r--r--src/crypto/crypto.h7
-rw-r--r--src/cryptonote_core/blockchain.cpp6
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.h2
4 files changed, 14 insertions, 14 deletions
diff --git a/src/crypto/crypto.cpp b/src/crypto/crypto.cpp
index fa7b1b580..e47aab0f7 100644
--- a/src/crypto/crypto.cpp
+++ b/src/crypto/crypto.cpp
@@ -34,7 +34,8 @@
#include <cstdlib>
#include <cstring>
#include <memory>
-#include <mutex>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/lock_guard.hpp>
#include "common/varint.h"
#include "warnings.h"
@@ -52,8 +53,6 @@ namespace crypto {
using std::abort;
using std::int32_t;
using std::int64_t;
- using std::lock_guard;
- using std::mutex;
using std::size_t;
using std::uint32_t;
using std::uint64_t;
@@ -63,7 +62,7 @@ namespace crypto {
#include "random.h"
}
- mutex random_lock;
+ boost::mutex random_lock;
static inline unsigned char *operator &(ec_point &point) {
return &reinterpret_cast<unsigned char &>(point);
@@ -100,7 +99,7 @@ namespace crypto {
*
*/
secret_key crypto_ops::generate_keys(public_key &pub, secret_key &sec, const secret_key& recovery_key, bool recover) {
- lock_guard<mutex> lock(random_lock);
+ boost::lock_guard<boost::mutex> lock(random_lock);
ge_p3 point;
secret_key rng;
@@ -199,7 +198,7 @@ namespace crypto {
};
void crypto_ops::generate_signature(const hash &prefix_hash, const public_key &pub, const secret_key &sec, signature &sig) {
- lock_guard<mutex> lock(random_lock);
+ boost::lock_guard<boost::mutex> lock(random_lock);
ge_p3 tmp3;
ec_scalar k;
s_comm buf;
@@ -280,7 +279,7 @@ POP_WARNINGS
const public_key *const *pubs, size_t pubs_count,
const secret_key &sec, size_t sec_index,
signature *sig) {
- lock_guard<mutex> lock(random_lock);
+ boost::lock_guard<boost::mutex> lock(random_lock);
size_t i;
ge_p3 image_unp;
ge_dsmp image_pre;
diff --git a/src/crypto/crypto.h b/src/crypto/crypto.h
index 360b571f3..883aa521a 100644
--- a/src/crypto/crypto.h
+++ b/src/crypto/crypto.h
@@ -31,7 +31,8 @@
#pragma once
#include <cstddef>
-#include <mutex>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/lock_guard.hpp>
#include <vector>
#include "common/pod-class.h"
@@ -44,7 +45,7 @@ namespace crypto {
#include "random.h"
}
- extern std::mutex random_lock;
+ extern boost::mutex random_lock;
#pragma pack(push, 1)
POD_CLASS ec_point {
@@ -121,7 +122,7 @@ namespace crypto {
template<typename T>
typename std::enable_if<std::is_pod<T>::value, T>::type rand() {
typename std::remove_cv<T>::type res;
- std::lock_guard<std::mutex> lock(random_lock);
+ boost::lock_guard<boost::mutex> lock(random_lock);
generate_random_bytes(sizeof(T), &res);
return res;
}
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 2aa8ecec4..f540697dc 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -2105,7 +2105,7 @@ bool Blockchain::check_tx_inputs(const transaction& tx, uint64_t* pmax_used_bloc
std::vector < uint64_t > results;
results.resize(tx.vin.size(), 0);
- int threads = std::thread::hardware_concurrency();
+ int threads = boost::thread::hardware_concurrency();
boost::asio::io_service ioservice;
boost::thread_group threadpool;
@@ -2965,7 +2965,7 @@ bool Blockchain::prepare_handle_incoming_blocks(const std::list<block_complete_e
return true;
bool blocks_exist = false;
- uint64_t threads = std::thread::hardware_concurrency();
+ uint64_t threads = boost::thread::hardware_concurrency();
if (blocks_entry.size() > 1 && threads > 1 && m_max_prepare_blocks_threads > 1)
{
@@ -3165,7 +3165,7 @@ bool Blockchain::prepare_handle_incoming_blocks(const std::list<block_complete_e
// [output] stores all transactions for each tx_out_index::hash found
std::vector<std::unordered_map<crypto::hash, cryptonote::transaction>> transactions(amounts.size());
- threads = std::thread::hardware_concurrency();
+ threads = boost::thread::hardware_concurrency();
if (!m_db->can_thread_bulk_indices())
threads = 1;
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.h b/src/cryptonote_protocol/cryptonote_protocol_handler.h
index c2d428025..1c92958c9 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.h
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.h
@@ -134,7 +134,7 @@ namespace cryptonote
bool m_one_request = true;
// static std::ofstream m_logreq;
- std::mutex m_buffer_mutex;
+ boost::mutex m_buffer_mutex;
double get_avg_block_size();
boost::circular_buffer<size_t> m_avg_buffer = boost::circular_buffer<size_t>(10);