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); pthread_mutex_unlock(&mg);
}else{ }else{
pthread_mutex_lock(&mg); pthread_mutex_lock(&mg);
acquiringDone = 1; acquiringDone = 1;
pthread_mutex_unlock(&mg); pthread_mutex_unlock(&mg);

View File

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