aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-02-12 14:00:16 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-02-12 21:05:28 +0000
commit09c8111c53a5adf3ca0e3d28d2b2652cc794efdb (patch)
tree6a117343036dc1de826db9c62d81a210793af028 /src
parentconsole_handler: do not let exception past the dor (diff)
downloadmonero-09c8111c53a5adf3ca0e3d28d2b2652cc794efdb.tar.xz
threadpool: lock mutex in create
In some contrived case, it might theoretically be the case that destroy is called from another thread, which would modify the threads array from two threads. Coverity 208372
Diffstat (limited to 'src')
-rw-r--r--src/common/threadpool.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/common/threadpool.cpp b/src/common/threadpool.cpp
index 18204eeee..753bf238c 100644
--- a/src/common/threadpool.cpp
+++ b/src/common/threadpool.cpp
@@ -71,6 +71,7 @@ void threadpool::recycle() {
}
void threadpool::create(unsigned int max_threads) {
+ const boost::unique_lock<boost::mutex> lock(mutex);
boost::thread::attributes attrs;
attrs.set_stack_size(THREAD_STACK_SIZE);
max = max_threads ? max_threads : tools::get_max_concurrency();