bug fixed: must wait to get data for scans

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@71 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d
2012-09-25 11:44:49 +00:00
parent e6e991bc64
commit d56780d906

View File

@ -590,6 +590,7 @@ int qDrawPlot::GetData(detectorData *data){
if(scanArgument!=None){
//alframes
if(scanArgument==AllFrames){
while(1){
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
//variables
lastImageNumber= currentFrame+1;
@ -600,6 +601,8 @@ int qDrawPlot::GetData(detectorData *data){
//copy data
memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double));
pthread_mutex_unlock(&(last_image_complete_mutex));
break;
}
}
currentFrame++;
currentScanDivLevel++;
@ -607,6 +610,7 @@ int qDrawPlot::GetData(detectorData *data){
}
//file index
if(scanArgument==FileIndex){
while(1){
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
//variables
int currentIndex = fileIOStatic::getFileIndexFromFileName(string(data->fileName));
@ -619,6 +623,8 @@ int qDrawPlot::GetData(detectorData *data){
//copy data
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
pthread_mutex_unlock(&(last_image_complete_mutex));
break;
}
}
currentFrame++;
currentScanDivLevel++;
@ -626,6 +632,7 @@ int qDrawPlot::GetData(detectorData *data){
}
//level0
if(scanArgument==Level0){
while(1){
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
//get scanvariable0
int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0;
@ -644,11 +651,14 @@ int qDrawPlot::GetData(detectorData *data){
//copy data
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
pthread_mutex_unlock(&(last_image_complete_mutex));
break;
}
}
currentFrame++;
return 0;
}
//level1
while(1){
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
//get scanvariable1
int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0;
@ -665,6 +675,8 @@ int qDrawPlot::GetData(detectorData *data){
//copy data
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
pthread_mutex_unlock(&(last_image_complete_mutex));
break;
}
}
currentFrame++;
return 0;