diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index f120c9fd1..e4622fab7 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -5329,11 +5329,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 @@ -5378,21 +5385,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 56c1a250a..2c1540ca6 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUtils.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorUtils.h @@ -890,12 +890,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; };