mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-05 17:40:40 +02:00
ensure gui gets measurement finished after dummy packet received from receiver/ext process
This commit is contained in:
parent
397344a264
commit
1edb41242c
@ -5942,12 +5942,16 @@ void multiSlsDetector::readFrameFromReceiver(){
|
||||
|
||||
//all done
|
||||
if(!numRunning){
|
||||
// let main thread know that all dummy packets have been received (also from external process),
|
||||
// main thread can now proceed to measurement finished call back
|
||||
sem_post(&sem_endRTAcquisition);
|
||||
// wait for next scan/measurement, else join thread
|
||||
sem_wait(&sem_newRTAcquisition);
|
||||
//done with complete acquisition
|
||||
if(checkJoinThread())
|
||||
break;
|
||||
else{
|
||||
//starting a new scan/measurement
|
||||
//starting a new scan/measurement (got dummy data)
|
||||
for(int i = 0; i < numSockets; ++i)
|
||||
runningList[i] = true;
|
||||
numRunning = numSockets;
|
||||
|
@ -58,6 +58,8 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
//not in the loop for real time acqusition yet,
|
||||
//in the real time acquisition loop, processing thread will wait for a post each time
|
||||
sem_init(&sem_newRTAcquisition,1,0);
|
||||
//in the real time acquistion loop, main thread will wait for processing thread to be done each time (which in turn waits for receiver/ext process)
|
||||
sem_init(&sem_endRTAcquisition,1,0);
|
||||
|
||||
|
||||
bool receiver = (setReceiverOnline()==ONLINE_FLAG);
|
||||
@ -351,6 +353,11 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
else{
|
||||
if (stopReceiver() == FAIL)
|
||||
*stoppedFlag = 1;
|
||||
else {
|
||||
if (*threadedProcessing && dataReady) // threaded processing
|
||||
sem_wait(&sem_endRTAcquisition); // waits for receiver's external process to be done sending data to gui
|
||||
}
|
||||
|
||||
// cout<<"***********receiver stopped"<<endl;
|
||||
}
|
||||
pthread_mutex_unlock(&mg);//cout << "unlock"<< endl;
|
||||
@ -504,13 +511,15 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
cout << "acquisition finished callback done " << endl;
|
||||
#endif
|
||||
|
||||
setAcquiringFlag(false);
|
||||
sem_destroy(&sem_newRTAcquisition);
|
||||
sem_destroy(&sem_endRTAcquisition);
|
||||
|
||||
#ifdef VERBOSE
|
||||
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;
|
||||
#endif
|
||||
setAcquiringFlag(false);
|
||||
|
||||
return OK;
|
||||
|
||||
}
|
||||
|
@ -1000,7 +1000,10 @@ virtual int setReceiverSilentMode(int i = -1)=0;
|
||||
int (*progress_call)(double,void*);
|
||||
void *pProgressCallArg;
|
||||
|
||||
/** semaphore to let postprocessing thread continue for next scan/measurement */
|
||||
sem_t sem_newRTAcquisition;
|
||||
/** semaphore to let main thread know it got all the dummy packets (also from ext. process) */
|
||||
sem_t sem_endRTAcquisition;
|
||||
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user