aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorSChernykh <sergey.v.chernykh@gmail.com>2022-06-14 21:23:23 +0200
committerSChernykh <sergey.v.chernykh@gmail.com>2022-09-20 10:22:12 +0200
commit6adf03cdc516a9236aac6dbd6f289750761b8d24 (patch)
treedd316915f51aaae8d711832b0bc40374dd822ba5 /src/common
parentMerge pull request #8545 (diff)
downloadmonero-6adf03cdc516a9236aac6dbd6f289750761b8d24.tar.xz
Second thread pool for IO
Diffstat (limited to 'src/common')
-rw-r--r--src/common/dns_utils.cpp2
-rw-r--r--src/common/threadpool.h6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/common/dns_utils.cpp b/src/common/dns_utils.cpp
index 6ab6ff4fe..7bb1781d4 100644
--- a/src/common/dns_utils.cpp
+++ b/src/common/dns_utils.cpp
@@ -521,7 +521,7 @@ bool load_txt_records_from_dns(std::vector<std::string> &good_records, const std
// send all requests in parallel
std::deque<bool> avail(dns_urls.size(), false), valid(dns_urls.size(), false);
- tools::threadpool& tpool = tools::threadpool::getInstance();
+ tools::threadpool& tpool = tools::threadpool::getInstanceForIO();
tools::threadpool::waiter waiter(tpool);
for (size_t n = 0; n < dns_urls.size(); ++n)
{
diff --git a/src/common/threadpool.h b/src/common/threadpool.h
index ce1bc5799..53421e18b 100644
--- a/src/common/threadpool.h
+++ b/src/common/threadpool.h
@@ -42,10 +42,14 @@ namespace tools
class threadpool
{
public:
- static threadpool& getInstance() {
+ static threadpool& getInstanceForCompute() {
static threadpool instance;
return instance;
}
+ static threadpool& getInstanceForIO() {
+ static threadpool instance(8);
+ return instance;
+ }
static threadpool *getNewForUnitTests(unsigned max_threads = 0) {
return new threadpool(max_threads);
}