mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
make it work for multi threaded compression receiver for moench only
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@723 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
f4deb5856d
commit
a39e828e3a
@ -6,6 +6,10 @@
|
|||||||
#include "slsReceiver_funcs.h"
|
#include "slsReceiver_funcs.h"
|
||||||
#include "slsReceiverFunctionList.h"
|
#include "slsReceiverFunctionList.h"
|
||||||
#include "svnInfoReceiver.h"
|
#include "svnInfoReceiver.h"
|
||||||
|
#include "slsReceiverUsers.h"
|
||||||
|
|
||||||
|
#include <signal.h> //SIGINT
|
||||||
|
#include <cstdlib> //EXIT
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -20,11 +24,11 @@ int slsReceiverFuncs::socketDescriptor(-1);
|
|||||||
|
|
||||||
|
|
||||||
slsReceiverFuncs::~slsReceiverFuncs() {
|
slsReceiverFuncs::~slsReceiverFuncs() {
|
||||||
|
/*if(file_des != -1){close(file_des);file_des = -1;}
|
||||||
slsReceiverFuncs::closeFile(0);
|
//shutdown(socketDescriptor,SHUT_RDWR);
|
||||||
cout << "Goodbye!" << endl;
|
close(socketDescriptor);*/
|
||||||
if(socket) delete socket;
|
if(socket) delete socket;
|
||||||
|
closeFile(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -249,7 +253,10 @@ slsReceiverFuncs::slsReceiverFuncs(int argc, char *argv[], int &success):
|
|||||||
function_table();
|
function_table();
|
||||||
slsReceiverList = new slsReceiverFunctionList(myDetectorType);
|
slsReceiverList = new slsReceiverFunctionList(myDetectorType);
|
||||||
|
|
||||||
if(dcompr) slsReceiverList->enableDataCompression(dcompr);
|
//Catch signal SIGINT to close files properly
|
||||||
|
signal(SIGINT,staticCloseFile);
|
||||||
|
|
||||||
|
/*if(dcompr)*/ slsReceiverList->enableDataCompression(dcompr);
|
||||||
/*if(jobthread!=-1) slsReceiverList->setNumberOfJobsPerThread(jobthread);*/
|
/*if(jobthread!=-1) slsReceiverList->setNumberOfJobsPerThread(jobthread);*/
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -395,18 +402,17 @@ int slsReceiverFuncs::M_nofunc(){
|
|||||||
|
|
||||||
|
|
||||||
void slsReceiverFuncs::closeFile(int p){
|
void slsReceiverFuncs::closeFile(int p){
|
||||||
|
cout<<"Closing Files... "<<endl;
|
||||||
|
slsReceiverList->closeFile();
|
||||||
if(slsReceiverFunctionList::receiver_threads_running)
|
cout << "Goodbye!" << endl;
|
||||||
fclose(slsReceiverFunctionList::sfilefd);
|
exit(1);
|
||||||
|
|
||||||
|
|
||||||
close(file_des);
|
|
||||||
//shutdown(socketDescriptor,SHUT_RDWR);
|
|
||||||
close(socketDescriptor);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void slsReceiverFuncs::staticCloseFile(int p){
|
||||||
|
slsReceiverUsers::receiver->closeFile(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -983,7 +989,6 @@ int slsReceiverFuncs::moench_read_frame(){
|
|||||||
uint32_t startIndex=0;
|
uint32_t startIndex=0;
|
||||||
int index = 0,bindex = 0, offset=0;
|
int index = 0,bindex = 0, offset=0;
|
||||||
|
|
||||||
|
|
||||||
strcpy(mess,"Could not read frame\n");
|
strcpy(mess,"Could not read frame\n");
|
||||||
|
|
||||||
|
|
||||||
@ -1026,6 +1031,7 @@ int slsReceiverFuncs::moench_read_frame(){
|
|||||||
int iPacket = 0;
|
int iPacket = 0;
|
||||||
offset = 4;
|
offset = 4;
|
||||||
|
|
||||||
|
|
||||||
while (iPacket < (int)numPackets){
|
while (iPacket < (int)numPackets){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("iPacket:%d\n",iPacket);cout << endl;
|
printf("iPacket:%d\n",iPacket);cout << endl;
|
||||||
@ -1039,11 +1045,12 @@ int slsReceiverFuncs::moench_read_frame(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
packetIndex = bindex & MOENCH_PACKET_INDEX_MASK;
|
packetIndex = bindex & MOENCH_PACKET_INDEX_MASK;
|
||||||
|
//cout<<"packetIndex:"<<packetIndex<<endl;
|
||||||
//the first packet is placed in the end
|
//the first packet is placed in the end
|
||||||
packetIndex--;
|
packetIndex--;
|
||||||
if(packetIndex ==-1)
|
if(packetIndex ==-1)
|
||||||
packetIndex = 39;
|
packetIndex = 39;
|
||||||
|
//cout<<"packetIndexM:"<<packetIndex<<endl;
|
||||||
//check validity
|
//check validity
|
||||||
if ((packetIndex >= 40) && (packetIndex < 0))
|
if ((packetIndex >= 40) && (packetIndex < 0))
|
||||||
cout << "cannot decode packet index:" << packetIndex << endl;
|
cout << "cannot decode packet index:" << packetIndex << endl;
|
||||||
@ -1086,6 +1093,7 @@ int slsReceiverFuncs::moench_read_frame(){
|
|||||||
cout << "\nstartIndex:" << startIndex << endl;
|
cout << "\nstartIndex:" << startIndex << endl;
|
||||||
cout << "fName:" << fName << endl;
|
cout << "fName:" << fName << endl;
|
||||||
cout << "index:" << arg << endl;
|
cout << "index:" << arg << endl;
|
||||||
|
if(retval==NULL)cout<<"retval is null"<<endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user