From 64843c1c767958f42e9fafd453415098bcc62180 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Fri, 16 Dec 2016 14:46:54 +0100 Subject: [PATCH] made the scans work, where the the dummy message from rxr doesnt stop it from listening for the scans/measurement, only at set join thread --- .../multiSlsDetector/multiSlsDetector.cpp | 44 ++++++++++++++----- .../slsDetector/slsDetectorUtils.cpp | 13 ++++++ .../slsDetector/slsDetectorUtils.h | 4 +- 3 files changed, 47 insertions(+), 14 deletions(-) diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index 7456c8408..b6e6c3001 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -5305,11 +5305,18 @@ void multiSlsDetector::readFrameFromReceiver(){ volatile uint64_t dataThreadMask = 0x0; + + //wait for real time acquisition to start + bool running = true; + sem_wait(&sem_newRTAcquisition); + if(checkJoinThread()) + running = false; + for(int i = 0; i < numSockets; ++i) dataThreadMask|=(1<numberOfDetectors); //reset frame memory //get each frame @@ -5354,21 +5361,36 @@ void multiSlsDetector::readFrameFromReceiver(){ } + //all done - if(!dataThreadMask) - break; + if(!dataThreadMask){ + sem_wait(&sem_newRTAcquisition); + //done with complete acquisition + if(checkJoinThread()) + break; + else{ + //starting a new scan/measurement + for(int i = 0; i < numSockets; ++i) + dataThreadMask|=(1<0) { @@ -462,6 +471,9 @@ int slsDetectorUtils::acquire(int delflag){ } + //let processing thread continue and checkjointhread + sem_post(&sem_newRTAcquisition); + // waiting for the data processing thread to finish! if (*threadedProcessing) { #ifdef VERBOSE @@ -499,6 +511,7 @@ int slsDetectorUtils::acquire(int delflag){ #endif setAcquiringFlag(false); + sem_destroy(&sem_newRTAcquisition); clock_gettime(CLOCK_REALTIME, &end); cout << "Elapsed time for acquisition:" << (( end.tv_sec - begin.tv_sec ) + ( end.tv_nsec - begin.tv_nsec ) / 1000000000.0) << " seconds" << endl; diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUtils.h b/slsDetectorSoftware/slsDetector/slsDetectorUtils.h index e74a8ab7e..cc354b737 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUtils.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorUtils.h @@ -878,12 +878,10 @@ virtual int setReceiverFifoDepth(int i = -1)=0; int (*acquisition_finished)(double,int,void*); int (*measurement_finished)(int,int,void*); void *acqFinished_p, *measFinished_p; - - - int (*progress_call)(double,void*); void *pProgressCallArg; + sem_t sem_newRTAcquisition; };