From 7a2e42d59add6e7e27e7e65f532bb1af9343ef80 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Tue, 10 Mar 2015 15:03:08 +0100 Subject: [PATCH] changed the way gui polls receiver for data for nth frame and otherwise --- .../slsDetector/slsDetectorUtils.cpp | 1 - .../slsDetectorAnalysis/postProcessing.cpp | 52 +++++++++++-------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp b/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp index f729a4d9e..ab39eaecc 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp @@ -342,7 +342,6 @@ void slsDetectorUtils::acquire(int delflag){ } pthread_mutex_unlock(&mg); }else{ - pthread_mutex_lock(&mg); acquiringDone = 1; pthread_mutex_unlock(&mg); diff --git a/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp b/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp index b2854f4bd..67f8046e1 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp +++ b/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp @@ -483,7 +483,7 @@ void* postProcessing::processData(int delflag) { } //receiver else{ - /* + /* //without gui loop while(1){ if (checkJoinThread()) break; @@ -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,27 +553,37 @@ 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; + cout << "gonna post for it to end" << endl; #endif - sem_post(&sem_queue); + sem_post(&sem_queue); #ifdef VERY_VERY_DEBUG - cout << "Sem posted" << endl; + cout << "Sem posted" << endl; #endif - //newData = false; + } } - }else if (checkJoinThread()) - break; + } + //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***"< progress){ #ifdef VERY_VERY_DEBUG - cout<<"GOT data"<