mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
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
This commit is contained in:
parent
760ecf2ac8
commit
09c8111c53
@ -71,6 +71,7 @@ void threadpool::recycle() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void threadpool::create(unsigned int max_threads) {
|
void threadpool::create(unsigned int max_threads) {
|
||||||
|
const boost::unique_lock<boost::mutex> lock(mutex);
|
||||||
boost::thread::attributes attrs;
|
boost::thread::attributes attrs;
|
||||||
attrs.set_stack_size(THREAD_STACK_SIZE);
|
attrs.set_stack_size(THREAD_STACK_SIZE);
|
||||||
max = max_threads ? max_threads : tools::get_max_concurrency();
|
max = max_threads ? max_threads : tools::get_max_concurrency();
|
||||||
|
Loading…
Reference in New Issue
Block a user