From 70ae2ee711c8262f5aba9ebe81f7b5b49bc26e6b Mon Sep 17 00:00:00 2001 From: NoodleDoodleNoodleDoodleNoodleDoodleNoo Date: Fri, 17 Jul 2015 20:02:29 -0700 Subject: Fixed threadpool bug when running on single core systems. *Thanks to freshman for reporting bug. --- src/cryptonote_core/blockchain.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/cryptonote_core') diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index ea107abb6..ffd4e7869 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -2009,11 +2009,14 @@ bool Blockchain::check_tx_inputs(const transaction& tx, uint64_t* pmax_used_bloc boost::thread_group threadpool; std::auto_ptr < boost::asio::io_service::work > work(new boost::asio::io_service::work(ioservice)); - for (int i = 0; i < threads; i++) - { - threadpool.create_thread(boost::bind(&boost::asio::io_service::run, &ioservice)); - } - + if(threads > 1) + { + for (int i = 0; i < threads; i++) + { + threadpool.create_thread(boost::bind(&boost::asio::io_service::run, &ioservice)); + } + } + #define KILL_IOSERVICE() \ if(threads > 1) \ { \ -- cgit v1.2.3