creating and destroying sockets for each receiver start and stop in a single acquisition (to deal with scans etc)

This commit is contained in:
Dhanya Maliakal
2016-09-21 16:37:29 +02:00
parent a1df8bdc15
commit d0501c3139
6 changed files with 289 additions and 143 deletions

View File

@ -173,9 +173,11 @@ int slsDetectorUtils::acquire(int delflag){
if (*threadedProcessing) {
if(dataReady)
sem_init(&dataThreadStartedSemaphore,1,0);
startThread(delflag);
sem_init(&dataThreadStartedSemaphore,1,0);
startThread(delflag);
if(dataReady)
createReceivingDataThreads();
}
#ifdef VERBOSE
cout << " starting thread " << endl;
@ -186,9 +188,6 @@ int slsDetectorUtils::acquire(int delflag){
resetFramesCaught();
}
if(*threadedProcessing && dataReady)
sem_wait(&dataThreadStartedSemaphore);
for(int im=0;im<nm;im++) {
#ifdef VERBOSE
@ -315,6 +314,11 @@ int slsDetectorUtils::acquire(int delflag){
break;
}
pthread_mutex_unlock(&mg);
//start the receiving sockets in their threads
if(*threadedProcessing && dataReady){
startReceivingData();
}
}
#ifdef VERBOSE
cout << "Acquiring " << endl;
@ -484,13 +488,18 @@ int slsDetectorUtils::acquire(int delflag){
#ifdef VERBOSE
cout << "wait for data processing thread" << endl;
#endif
if(dataReady){
//if mask is not cleared, clear it
}
setJoinThread(1);
pthread_join(dataProcessingThread, &status);
#ifdef VERBOSE
cout << "data processing thread joined" << endl;
#endif
if(dataReady)
if(dataReady){
createReceivingDataThreads(true);
sem_destroy(&dataThreadStartedSemaphore);
}
}