mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-29 09:30:02 +02:00
refactoring and reducing overhead
This commit is contained in:
parent
53f11c499d
commit
113e522399
@ -856,7 +856,6 @@ int UDPStandardImplementation::startReceiver(char *c){
|
|||||||
for(int i=0;i<numberofListeningThreads;i++) sem_post(&listenSemaphore[i]);
|
for(int i=0;i<numberofListeningThreads;i++) sem_post(&listenSemaphore[i]);
|
||||||
for(int i=0; i < numberofWriterThreads; i++) sem_post(&writerSemaphore[i]);
|
for(int i=0; i < numberofWriterThreads; i++) sem_post(&writerSemaphore[i]);
|
||||||
|
|
||||||
//usleep(5000000);
|
|
||||||
cout << "Receiver Started" << endl;
|
cout << "Receiver Started" << endl;
|
||||||
cout << "Status: " << runStatusType(status) << endl;
|
cout << "Status: " << runStatusType(status) << endl;
|
||||||
|
|
||||||
@ -927,13 +926,28 @@ void UDPStandardImplementation::startReadout(){
|
|||||||
FILE_LOG(logDEBUG) << "Info: Transmitting last data";
|
FILE_LOG(logDEBUG) << "Info: Transmitting last data";
|
||||||
|
|
||||||
if(status == RUNNING){
|
if(status == RUNNING){
|
||||||
//wait for all packets
|
|
||||||
uint64_t prev = totalPacketsCaught;
|
//check if all packets got
|
||||||
usleep(50000);
|
int totalP = 0,prev,i;
|
||||||
while(prev!=totalPacketsCaught){
|
for(i=0; i<numberofListeningThreads; ++i){
|
||||||
prev=totalPacketsCaught;
|
totalP += totalListeningFrameCount[i];
|
||||||
usleep(50000);
|
|
||||||
}
|
}
|
||||||
|
//wait for all packets
|
||||||
|
if(totalP!=numberOfFrames*packetsPerFrame){
|
||||||
|
prev = -1;
|
||||||
|
//wait as long as there is change from prev totalP
|
||||||
|
while(prev != totalP){
|
||||||
|
cprintf(MAGENTA,"waiting for all packets\n");
|
||||||
|
usleep(1000);/* Need to find optimal time (exposure time and acquisition period) **/
|
||||||
|
prev = totalP;
|
||||||
|
totalP=0;
|
||||||
|
for(i=0; i<numberofListeningThreads; ++i){
|
||||||
|
totalP += totalListeningFrameCount[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else cprintf(MAGENTA,"Got all packets without waiting\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//set status
|
//set status
|
||||||
pthread_mutex_lock(&statusMutex);
|
pthread_mutex_lock(&statusMutex);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user