refine threadpool mutex, remove unlock before destroying, unlocking twice is undefined behaviour

This commit is contained in:
helfenstein_p
2017-12-11 18:02:33 +01:00
parent bb3e5351b4
commit 03de29de90
3 changed files with 12 additions and 9 deletions

View File

@ -294,9 +294,8 @@ multiSlsDetector::~multiSlsDetector() {
int multiSlsDetector::createThreadPool(){
if(threadpool){
threadpool->destroy_threadpool();
}
if(threadpool)
destroyThreadPool();
int numthreads = thisMultiDetector->numberOfDetectors;
if(numthreads < 1){
numthreads = 1; //create threadpool anyway, threads initialized only when >1 detector added
@ -322,7 +321,6 @@ int multiSlsDetector::createThreadPool(){
void multiSlsDetector::destroyThreadPool(){
if(threadpool){
threadpool->destroy_threadpool();
delete threadpool;
threadpool=0;
#ifdef VERBOSE