aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormydesktop <dev.mc2@gmail.com>2014-04-30 16:50:06 -0400
committermydesktop <dev.mc2@gmail.com>2014-04-30 16:50:06 -0400
commit79a4bedc3669dfd3a3845e78ede144b5d7be7d1c (patch)
treeb34d971740ab96625267b6d2fd3f03fa6ac81977 /src
parentvarious fixes to allow mac osx compilation (diff)
downloadmonero-79a4bedc3669dfd3a3845e78ede144b5d7be7d1c.tar.xz
mac osx building fixes
Diffstat (limited to 'src')
-rw-r--r--src/cryptonote_config.h2
-rw-r--r--src/cryptonote_core/miner.cpp11
-rw-r--r--src/cryptonote_core/miner.h2
-rw-r--r--src/daemon/daemon_commands_handler.h5
-rw-r--r--src/p2p/net_node.inl5
-rw-r--r--src/rpc/core_rpc_server.cpp5
6 files changed, 22 insertions, 8 deletions
diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h
index b7c0170e3..34d053aa8 100644
--- a/src/cryptonote_config.h
+++ b/src/cryptonote_config.h
@@ -79,5 +79,5 @@
#define P2P_NET_DATA_FILENAME "p2pstate.bin"
#define MINER_CONFIG_FILE_NAME "miner_conf.json"
-
+#define THREAD_STACK_SIZE 5 * 1024 * 1024
diff --git a/src/cryptonote_core/miner.cpp b/src/cryptonote_core/miner.cpp
index 142c81f68..56b459d6e 100644
--- a/src/cryptonote_core/miner.cpp
+++ b/src/cryptonote_core/miner.cpp
@@ -193,7 +193,7 @@ namespace cryptonote
return !m_stop;
}
//-----------------------------------------------------------------------------------------------------
- bool miner::start(const account_public_address& adr, size_t threads_count)
+ bool miner::start(const account_public_address& adr, size_t threads_count, const boost::thread::attributes& attrs)
{
m_mine_address = adr;
m_threads_total = static_cast<uint32_t>(threads_count);
@@ -218,7 +218,9 @@ namespace cryptonote
boost::interprocess::ipcdetail::atomic_write32(&m_thread_index, 0);
for(size_t i = 0; i != threads_count; i++)
- m_threads.push_back(boost::thread(boost::bind(&miner::worker_thread, this)));
+ {
+ m_threads.push_back(boost::thread(attrs, boost::bind(&miner::worker_thread, this)));
+ }
LOG_PRINT_L0("Mining has started with " << threads_count << " threads, good luck!" )
return true;
@@ -269,7 +271,10 @@ namespace cryptonote
{
if(m_do_mining)
{
- start(m_mine_address, m_threads_total);
+ boost::thread::attributes attrs;
+ attrs.set_stack_size(THREAD_STACK_SIZE);
+
+ start(m_mine_address, m_threads_total, attrs);
}
}
//-----------------------------------------------------------------------------------------------------
diff --git a/src/cryptonote_core/miner.h b/src/cryptonote_core/miner.h
index 03f09509e..da4578b06 100644
--- a/src/cryptonote_core/miner.h
+++ b/src/cryptonote_core/miner.h
@@ -35,7 +35,7 @@ namespace cryptonote
static void init_options(boost::program_options::options_description& desc);
bool set_block_template(const block& bl, const difficulty_type& diffic, uint64_t height);
bool on_block_chain_update();
- bool start(const account_public_address& adr, size_t threads_count);
+ bool start(const account_public_address& adr, size_t threads_count, const boost::thread::attributes& attrs);
uint64_t get_speed();
void send_stop_signal();
bool stop();
diff --git a/src/daemon/daemon_commands_handler.h b/src/daemon/daemon_commands_handler.h
index 7695508c9..dca524f77 100644
--- a/src/daemon/daemon_commands_handler.h
+++ b/src/daemon/daemon_commands_handler.h
@@ -291,7 +291,10 @@ private:
threads_count = (ok && 0 < threads_count) ? threads_count : 1;
}
- m_srv.get_payload_object().get_core().get_miner().start(adr, threads_count);
+ boost::thread::attributes attrs;
+ attrs.set_stack_size(THREAD_STACK_SIZE);
+
+ m_srv.get_payload_object().get_core().get_miner().start(adr, threads_count, attrs);
return true;
}
//--------------------------------------------------------------------------------
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 4dafa2342..31d3e6597 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -278,9 +278,12 @@ namespace nodetool
m_net_server.add_idle_handler(boost::bind(&node_server<t_payload_net_handler>::idle_worker, this), 1000);
m_net_server.add_idle_handler(boost::bind(&t_payload_net_handler::on_idle, &m_payload_handler), 1000);
+ boost::thread::attributes attrs;
+ attrs.set_stack_size(THREAD_STACK_SIZE);
+
//go to loop
LOG_PRINT("Run net_service loop( " << thrds_count << " threads)...", LOG_LEVEL_0);
- if(!m_net_server.run_server(thrds_count))
+ if(!m_net_server.run_server(thrds_count, true, attrs))
{
LOG_ERROR("Failed to run net tcp server!");
}
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 311d2a145..4d78367b6 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -252,7 +252,10 @@ namespace cryptonote
return true;
}
- if(!m_core.get_miner().start(adr, static_cast<size_t>(req.threads_count)))
+ boost::thread::attributes attrs;
+ attrs.set_stack_size(THREAD_STACK_SIZE);
+
+ if(!m_core.get_miner().start(adr, static_cast<size_t>(req.threads_count), attrs))
{
res.status = "Failed, mining not started";
return true;