From 26c0520c10a937b4c9a0ac82fa565bc4ead9e3e9 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 6 Feb 2014 17:25:18 +0000 Subject: [PATCH] semaphore just to check when it is over git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@734 951219d9-93cf-4727-9268-0efd64621fa3 --- slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp | 12 ++++++++++-- .../slsDetectorAnalysis/postProcessing.cpp | 6 +++++- .../slsDetectorAnalysis/postProcessing.h | 5 ++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp b/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp index d77b6bc84..ed6543250 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp @@ -141,7 +141,9 @@ void slsDetectorUtils::acquire(int delflag){ } + if (*threadedProcessing) { + sem_init(&sem_queue,0,0); startThread(delflag); } #ifdef VERBOSE @@ -318,16 +320,21 @@ void slsDetectorUtils::acquire(int delflag){ if(setReceiverOnline()==OFFLINE_FLAG){ pthread_mutex_lock(&mg); // wait until data processing thread has finished the data + acquiringDone = 1; + if (*threadedProcessing) { + sem_wait(&sem_queue); + acquiringDone = 0; + } #ifdef VERBOSE cout << "check data queue size " << endl; #endif - while (dataQueueSize()){ + /*while (dataQueueSize()){ #ifdef VERBOSE cout << "AAAAAAAAA check data queue size " << endl; #endif usleep(100000); - } + }*/ if ((getDetectorsType()==GOTTHARD) || (getDetectorsType()==MOENCH)){ if((*correctionMask)&(1<