mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00: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
1 changed files with 1 additions and 0 deletions
|
@ -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 a new issue