changed the way gui polls receiver for data for nth frame and otherwise

This commit is contained in:
Dhanya Maliakal 2015-03-10 15:03:08 +01:00
parent cdd18182a8
commit 7a2e42d59a
2 changed files with 29 additions and 24 deletions

View File

@ -342,7 +342,6 @@ void slsDetectorUtils::acquire(int delflag){
}
pthread_mutex_unlock(&mg);
}else{
pthread_mutex_lock(&mg);
acquiringDone = 1;
pthread_mutex_unlock(&mg);

View File

@ -537,7 +537,10 @@ void* postProcessing::processData(int delflag) {
#endif
/** IF detector acquisition is done, let the acquire() thread know to finish up and force join thread */
// IF detector acquisition is done, let the acquire() thread know to finish up and force join thread
if(acquiringDone > 0){
#ifdef VERY_VERY_DEBUG
if(acquiringDone == 1)
@ -550,8 +553,9 @@ void* postProcessing::processData(int delflag) {
cout << "acquiringDone :" << acquiringDone << endl;
#endif
pthread_mutex_unlock(&mg);
//newData = true;
if (acquiringDone == 10){//for eiger, it is very slow, have to wait long to get last frame
//go through once more to get last nth frame data
if (acquiringDone >= 2){
if((!nthframe) ||(!newData)){
#ifdef VERY_VERY_DEBUG
cout << "gonna post for it to end" << endl;
#endif
@ -559,18 +563,27 @@ void* postProcessing::processData(int delflag) {
#ifdef VERY_VERY_DEBUG
cout << "Sem posted" << endl;
#endif
//newData = false;
}
}else if (checkJoinThread())
}
}
//random reads and for nthframe, checks if there is no new data
else if((!nthframe) ||(!newData)){
//cout <<"cecking now" << endl;
if (checkJoinThread())
break;
}
if (dataReady){
//for random reads, ask only if it has new data
if(!newData){
if(currentfIndex > progress)
newData = true;
#ifdef VERY_VERY_DEBUG
cout << "currentfindex:" << currentfIndex << " progress:" << progress << endl;
#endif
}
if(newData){
@ -594,12 +607,6 @@ void* postProcessing::processData(int delflag) {
currentfIndex = -1;
cout<<"****Detector Data returned is NULL***"<<endl;
}
/*if(nthframe){
if((currentfIndex == -1) || (currentfIndex == progress))
currentfIndex = -1;
else
progress = currentfIndex;
}*/
//not garbage frame
if(currentfIndex < 0){
@ -608,9 +615,9 @@ void* postProcessing::processData(int delflag) {
#endif
if(receiverData)
delete [] receiverData;
}else{
}else if (currentfIndex > progress){
#ifdef VERY_VERY_DEBUG
cout<<"GOT data"<<endl;
cout << "GOT data" << endl;
#endif
fdata = decodeData(receiverData);
delete [] receiverData;
@ -624,7 +631,6 @@ void* postProcessing::processData(int delflag) {
#ifdef VERY_VERY_DEBUG
cout << "progress:" << progress << endl;
#endif
/*if(!nthframe) //unnecessary to read every data, 09.12.2014**/
newData = false;
#ifdef VERY_VERY_DEBUG
cout << "newData set to false" << endl;