diff options
Diffstat (limited to 'src/ringct/rctSigs.cpp')
-rw-r--r-- | src/ringct/rctSigs.cpp | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/src/ringct/rctSigs.cpp b/src/ringct/rctSigs.cpp index 8efd6a07c..946325367 100644 --- a/src/ringct/rctSigs.cpp +++ b/src/ringct/rctSigs.cpp @@ -30,8 +30,7 @@ #include "misc_log_ex.h" #include "common/perf_timer.h" -#include "common/task_region.h" -#include "common/thread_group.h" +#include "common/threadpool.h" #include "common/util.h" #include "rctSigs.h" #include "cryptonote_basic/cryptonote_format_utils.h" @@ -731,17 +730,16 @@ namespace rct { try { if (semantics) { + tools::threadpool& tpool = tools::threadpool::getInstance(); + tools::threadpool::waiter waiter; std::deque<bool> results(rv.outPk.size(), false); - tools::thread_group threadpool(tools::thread_group::optimal_with_max(rv.outPk.size())); - - tools::task_region(threadpool, [&] (tools::task_region_handle& region) { - DP("range proofs verified?"); - for (size_t i = 0; i < rv.outPk.size(); i++) { - region.run([&, i] { - results[i] = verRange(rv.outPk[i].mask, rv.p.rangeSigs[i]); - }); - } - }); + DP("range proofs verified?"); + for (size_t i = 0; i < rv.outPk.size(); i++) { + tpool.submit(&waiter, [&, i] { + results[i] = verRange(rv.outPk[i].mask, rv.p.rangeSigs[i]); + }); + } + waiter.wait(); for (size_t i = 0; i < rv.outPk.size(); ++i) { if (!results[i]) { @@ -794,7 +792,8 @@ namespace rct { const size_t threads = std::max(rv.outPk.size(), rv.mixRing.size()); std::deque<bool> results(threads); - tools::thread_group threadpool(tools::thread_group::optimal_with_max(threads)); + tools::threadpool& tpool = tools::threadpool::getInstance(); + tools::threadpool::waiter waiter; if (semantics) { key sumOutpks = identity(); @@ -819,13 +818,12 @@ namespace rct { results.clear(); results.resize(rv.outPk.size()); - tools::task_region(threadpool, [&] (tools::task_region_handle& region) { - for (size_t i = 0; i < rv.outPk.size(); i++) { - region.run([&, i] { - results[i] = verRange(rv.outPk[i].mask, rv.p.rangeSigs[i]); - }); - } - }); + for (size_t i = 0; i < rv.outPk.size(); i++) { + tpool.submit(&waiter, [&, i] { + results[i] = verRange(rv.outPk[i].mask, rv.p.rangeSigs[i]); + }); + } + waiter.wait(); for (size_t i = 0; i < results.size(); ++i) { if (!results[i]) { @@ -839,13 +837,12 @@ namespace rct { results.clear(); results.resize(rv.mixRing.size()); - tools::task_region(threadpool, [&] (tools::task_region_handle& region) { - for (size_t i = 0 ; i < rv.mixRing.size() ; i++) { - region.run([&, i] { + for (size_t i = 0 ; i < rv.mixRing.size() ; i++) { + tpool.submit(&waiter, [&, i] { results[i] = verRctMGSimple(message, rv.p.MGs[i], rv.mixRing[i], rv.pseudoOuts[i]); - }); - } - }); + }); + } + waiter.wait(); for (size_t i = 0; i < results.size(); ++i) { if (!results[i]) { |