mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
using parallel call for checkCompatibility
This commit is contained in:
parent
542dda8ece
commit
fc7ae98eee
@ -3452,7 +3452,7 @@ T multiSlsDetector::parallelCallDetectorMember(T (slsDetector::*somefunc)(P1), P
|
|||||||
cout << "Error in creating threadpool. Exiting" << endl;
|
cout << "Error in creating threadpool. Exiting" << endl;
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
std::vector<P1> return_values(thisMultiDetector->numberOfDetectors, -1);
|
std::vector<T> return_values(thisMultiDetector->numberOfDetectors, -1);
|
||||||
for (int idet = 0; idet < thisMultiDetector->numberOfDetectors; ++idet) {
|
for (int idet = 0; idet < thisMultiDetector->numberOfDetectors; ++idet) {
|
||||||
if (detectors[idet]) {
|
if (detectors[idet]) {
|
||||||
Task* task = new Task(new func1_t<T, P1>(somefunc,
|
Task* task = new Task(new func1_t<T, P1>(somefunc,
|
||||||
@ -6051,38 +6051,5 @@ bool multiSlsDetector::isAcquireReady()
|
|||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::checkVersionCompatibility(portType t) {
|
int multiSlsDetector::checkVersionCompatibility(portType t) {
|
||||||
int ret=-100;
|
return parallelCallDetectorMember(&slsDetector::checkVersionCompatibility, t);
|
||||||
|
|
||||||
if(!threadpool){
|
|
||||||
cout << "Error in creating threadpool. Exiting" << endl;
|
|
||||||
return -1;
|
|
||||||
}else{
|
|
||||||
//return storage values
|
|
||||||
int* iret[thisMultiDetector->numberOfDetectors];
|
|
||||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){
|
|
||||||
if(detectors[idet]){
|
|
||||||
iret[idet]= new int(-1);
|
|
||||||
Task* task = new Task(new func1_t<int,portType>(&slsDetector::checkVersionCompatibility,
|
|
||||||
detectors[idet],t,iret[idet]));
|
|
||||||
threadpool->add_task(task);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
threadpool->startExecuting();
|
|
||||||
threadpool->wait_for_tasks_to_complete();
|
|
||||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){
|
|
||||||
if(detectors[idet]){
|
|
||||||
if(iret[idet] != NULL){
|
|
||||||
if (ret==-100)
|
|
||||||
ret=*iret[idet];
|
|
||||||
else if (ret!=*iret[idet])
|
|
||||||
ret=-1;
|
|
||||||
delete iret[idet];
|
|
||||||
}else ret=-1;
|
|
||||||
if(detectors[idet]->getErrorMask())
|
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user