mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 23:37:14 +02:00
in the process of streamer
This commit is contained in:
@ -13,8 +13,10 @@
|
||||
#ifdef HDF5C
|
||||
#include "HDF5File.h"
|
||||
#endif
|
||||
#include "DataStreamer.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <errno.h>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
|
||||
@ -29,17 +31,17 @@ uint64_t DataProcessor::RunningMask(0x0);
|
||||
pthread_mutex_t DataProcessor::Mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
|
||||
DataProcessor::DataProcessor(Fifo*& f, runStatus* s, pthread_mutex_t* m, fileFormat* ftype, bool* fwenable,
|
||||
DataProcessor::DataProcessor(Fifo*& f, fileFormat* ftype, bool* fwenable, bool* dsEnable,
|
||||
int* cbaction,
|
||||
void (*dataReadycb)(int, char*, int, FILE*, char*, void*),
|
||||
void *pDataReadycb) :
|
||||
|
||||
ThreadObject(NumberofDataProcessors),
|
||||
generalData(0),
|
||||
fifo(f),
|
||||
dataStreamEnable(dsEnable),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
status(s),
|
||||
statusMutex(m),
|
||||
numTotalFramesCaught(0),
|
||||
numFramesCaught(0),
|
||||
firstAcquisitionIndex(0),
|
||||
@ -59,7 +61,7 @@ DataProcessor::DataProcessor(Fifo*& f, runStatus* s, pthread_mutex_t* m, fileFor
|
||||
}
|
||||
|
||||
NumberofDataProcessors++;
|
||||
FILE_LOG (logDEBUG) << "Number of DataProcessors: " << NumberofDataProcessors << endl;
|
||||
FILE_LOG (logDEBUG) << "Number of DataProcessors: " << NumberofDataProcessors;
|
||||
}
|
||||
|
||||
|
||||
@ -79,6 +81,10 @@ uint64_t DataProcessor::GetRunningMask() {
|
||||
return RunningMask;
|
||||
}
|
||||
|
||||
void DataProcessor::ResetRunningMask() {
|
||||
RunningMask = 0x0;
|
||||
}
|
||||
|
||||
/** non static functions */
|
||||
/** getters */
|
||||
string DataProcessor::GetType(){
|
||||
@ -126,7 +132,6 @@ void DataProcessor::StopRunning() {
|
||||
pthread_mutex_unlock(&Mutex);
|
||||
}
|
||||
|
||||
|
||||
void DataProcessor::SetFifo(Fifo*& f) {
|
||||
fifo = f;
|
||||
}
|
||||
@ -142,11 +147,6 @@ void DataProcessor::ResetParametersforNewMeasurement(){
|
||||
numFramesCaught = 0;
|
||||
firstMeasurementIndex = 0;
|
||||
measurementStartedFlag = false;
|
||||
if(RunningMask){
|
||||
pthread_mutex_lock(&Mutex);
|
||||
RunningMask = 0x0;
|
||||
pthread_mutex_unlock(&Mutex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -185,6 +185,15 @@ void DataProcessor::SetGeneralData(GeneralData* g) {
|
||||
}
|
||||
|
||||
|
||||
int DataProcessor::SetThreadPriority(int priority) {
|
||||
struct sched_param param;
|
||||
param.sched_priority = priority;
|
||||
if (pthread_setschedparam(thread, SCHED_RR, ¶m) == EPERM)
|
||||
return FAIL;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
void DataProcessor::SetFileFormat(const fileFormat f) {
|
||||
if (file->GetFileType() != f) {
|
||||
//remember the pointer values before they are destroyed
|
||||
@ -257,14 +266,22 @@ void DataProcessor::ThreadExecution() {
|
||||
|
||||
ProcessAnImage(buffer + FIFO_HEADER_NUMBYTES);
|
||||
|
||||
//free
|
||||
fifo->FreeAddress(buffer);
|
||||
//stream or free
|
||||
if (*dataStreamEnable)
|
||||
fifo->PushAddressToStream(buffer);
|
||||
else
|
||||
fifo->FreeAddress(buffer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DataProcessor::StopProcessing(char* buf) {
|
||||
fifo->FreeAddress(buf);
|
||||
//stream or free
|
||||
if (*dataStreamEnable)
|
||||
fifo->PushAddressToStream(buf);
|
||||
else
|
||||
fifo->FreeAddress(buf);
|
||||
|
||||
file->CloseCurrentFile();
|
||||
StopRunning();
|
||||
cprintf(BLUE,"%d: Processing Completed\n", index);
|
||||
|
@ -5,8 +5,12 @@
|
||||
|
||||
|
||||
#include "DataStreamer.h"
|
||||
#include "GeneralData.h"
|
||||
#include "Fifo.h"
|
||||
#include "ZmqSocket.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <errno.h>
|
||||
using namespace std;
|
||||
|
||||
const string DataStreamer::TypeName = "DataStreamer";
|
||||
@ -19,12 +23,36 @@ uint64_t DataStreamer::RunningMask(0x0);
|
||||
|
||||
pthread_mutex_t DataStreamer::Mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
const char* DataStreamer::jsonHeaderFormat_part1 =
|
||||
"{"
|
||||
"\"htype\":[\"chunk-1.0\"], "
|
||||
"\"type\":\"%s\", "
|
||||
"\"shape\":%s, ";
|
||||
|
||||
DataStreamer::DataStreamer() :
|
||||
ThreadObject(NumberofDataStreamers)
|
||||
const char* DataStreamer::jsonHeaderFormat =
|
||||
"%s"
|
||||
"\"acqIndex\":%lld, "
|
||||
"\"fIndex\":%lld, "
|
||||
"\"subfnum\":%lld, "
|
||||
"\"fname\":\"%s\"}";
|
||||
|
||||
|
||||
DataStreamer::DataStreamer(Fifo*& f, uint32_t* dr, uint32_t* freq, uint32_t* timer) :
|
||||
ThreadObject(NumberofDataStreamers),
|
||||
generalData(0),
|
||||
fifo(f),
|
||||
zmqSocket(0),
|
||||
dynamicRange(dr),
|
||||
streamingFrequency(freq),
|
||||
streamingTimerInMs(timer),
|
||||
currentFreqCount(0),
|
||||
currentHeader(0),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
firstAcquisitionIndex(0),
|
||||
firstMeasurementIndex(0)
|
||||
{
|
||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
||||
|
||||
memset(timerBegin, 0xFF, sizeof(timespec));
|
||||
if(ThreadObject::CreateThread()){
|
||||
pthread_mutex_lock(&Mutex);
|
||||
ErrorMask ^= (1<<index);
|
||||
@ -32,49 +60,44 @@ DataStreamer::DataStreamer() :
|
||||
}
|
||||
|
||||
NumberofDataStreamers++;
|
||||
FILE_LOG (logDEBUG) << "Number of DataStreamers: " << NumberofDataStreamers << endl;
|
||||
FILE_LOG (logDEBUG) << "Number of DataStreamers: " << NumberofDataStreamers;
|
||||
|
||||
}
|
||||
|
||||
|
||||
DataStreamer::~DataStreamer() {
|
||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
||||
CloseZmqSocket();
|
||||
ThreadObject::DestroyThread();
|
||||
NumberofDataStreamers--;
|
||||
}
|
||||
|
||||
/** static functions */
|
||||
|
||||
|
||||
uint64_t DataStreamer::GetErrorMask() {
|
||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
||||
return ErrorMask;
|
||||
}
|
||||
|
||||
|
||||
void DataStreamer::ResetRunningMask() {
|
||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
||||
pthread_mutex_lock(&Mutex);
|
||||
RunningMask = 0x0;
|
||||
pthread_mutex_unlock(&Mutex);
|
||||
uint64_t DataStreamer::GetRunningMask() {
|
||||
return RunningMask;
|
||||
}
|
||||
|
||||
void DataStreamer::ResetRunningMask() {
|
||||
RunningMask = 0x0;
|
||||
}
|
||||
|
||||
/** non static functions */
|
||||
|
||||
|
||||
/** getters */
|
||||
string DataStreamer::GetType(){
|
||||
return TypeName;
|
||||
}
|
||||
|
||||
|
||||
bool DataStreamer::IsRunning() {
|
||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
||||
return ((1 << index) & RunningMask);
|
||||
}
|
||||
|
||||
|
||||
/** setters */
|
||||
void DataStreamer::StartRunning() {
|
||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
||||
pthread_mutex_lock(&Mutex);
|
||||
RunningMask |= (1<<index);
|
||||
pthread_mutex_unlock(&Mutex);
|
||||
@ -82,15 +105,196 @@ void DataStreamer::StartRunning() {
|
||||
|
||||
|
||||
void DataStreamer::StopRunning() {
|
||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
||||
pthread_mutex_lock(&Mutex);
|
||||
RunningMask ^= (1<<index);
|
||||
pthread_mutex_unlock(&Mutex);
|
||||
}
|
||||
|
||||
void DataStreamer::SetFifo(Fifo*& f) {
|
||||
fifo = f;
|
||||
}
|
||||
|
||||
void DataStreamer::ResetParametersforNewAcquisition() {
|
||||
firstAcquisitionIndex = 0;
|
||||
acquisitionStartedFlag = false;
|
||||
}
|
||||
|
||||
void DataStreamer::ResetParametersforNewMeasurement(){
|
||||
firstMeasurementIndex = 0;
|
||||
measurementStartedFlag = false;
|
||||
|
||||
CreateHeaderPart1();
|
||||
}
|
||||
|
||||
|
||||
void DataStreamer::CreateHeaderPart1() {
|
||||
char *type;
|
||||
switch (*dynamicRange) {
|
||||
case 4: strcpy(type, "uint8"); break;
|
||||
case 8: strcpy(type, "uint8"); break;
|
||||
case 16: strcpy(type, "uint16"); break;
|
||||
case 32: strcpy(type, "uint32"); break;
|
||||
default:
|
||||
strcpy(type, "unknown");
|
||||
cprintf(RED," Unknown datatype in json format\n");
|
||||
break;
|
||||
}
|
||||
|
||||
char *shape= "[%d, %d]";
|
||||
sprintf(shape, shape, generalData->nPixelsX, generalData->nPixelsY);
|
||||
|
||||
sprintf(currentHeader, jsonHeaderFormat_part1, type, shape);
|
||||
}
|
||||
|
||||
|
||||
void DataStreamer::RecordFirstIndices(uint64_t fnum) {
|
||||
measurementStartedFlag = true;
|
||||
firstMeasurementIndex = fnum;
|
||||
|
||||
//start of entire acquisition
|
||||
if (!acquisitionStartedFlag) {
|
||||
acquisitionStartedFlag = true;
|
||||
firstAcquisitionIndex = fnum;
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
cprintf(BLUE,"%d First Acquisition Index:%lld\tFirst Measurement Index:%lld\n",
|
||||
index, (long long int)firstAcquisitionIndex, (long long int)firstMeasurementIndex);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void DataStreamer::SetGeneralData(GeneralData* g) {
|
||||
generalData = g;
|
||||
#ifdef VERY_VERBOSE
|
||||
generalData->Print();
|
||||
#endif
|
||||
}
|
||||
|
||||
int DataStreamer::SetThreadPriority(int priority) {
|
||||
struct sched_param param;
|
||||
param.sched_priority = priority;
|
||||
if (pthread_setschedparam(thread, SCHED_RR, ¶m) == EPERM)
|
||||
return FAIL;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
int DataStreamer::CreateZmqSockets(int* dindex, int* nunits) {
|
||||
uint32_t portnum = DEFAULT_ZMQ_PORTNO + ((*dindex) * (*nunits) + index);
|
||||
printf("%d Streamer: Port number: %d\n", index, portnum);
|
||||
|
||||
zmqSocket = new ZmqSocket(portnum);
|
||||
if (zmqSocket->GetErrorStatus()) {
|
||||
cprintf(RED, "Error: Could not create Zmq socket on port %d for Streamer %d\n", portnum, index);
|
||||
return FAIL;
|
||||
}
|
||||
printf("%d Streamer: Zmq Server started at %s\n",zmqSocket->GetZmqServerAddress());
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
void DataStreamer::CloseZmqSocket() {
|
||||
if (zmqSocket) {
|
||||
delete zmqSocket;
|
||||
zmqSocket = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DataStreamer::ThreadExecution() {
|
||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
||||
char* buffer=0;
|
||||
fifo->PopAddressToStream(buffer);
|
||||
#ifdef FIFODEBUG
|
||||
if (!index) cprintf(BLUE,"DataProcessor %d, pop 0x%p buffer:%s\n", index,(void*)(buffer),buffer);
|
||||
#endif
|
||||
|
||||
//check dummy
|
||||
uint32_t numBytes = (uint32_t)(*((uint32_t*)buffer));
|
||||
if (numBytes == DUMMY_PACKET_VALUE) {
|
||||
StopProcessing(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessAnImage(buffer + FIFO_HEADER_NUMBYTES);
|
||||
|
||||
//free
|
||||
fifo->FreeAddress(buffer);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DataStreamer::StopProcessing(char* buf) {
|
||||
fifo->FreeAddress(buf);
|
||||
StopRunning();
|
||||
cprintf(MAGENTA,"%d: Streaming Completed\n", index);
|
||||
}
|
||||
|
||||
|
||||
void DataStreamer::ProcessAnImage(char* buf) {
|
||||
uint64_t fnum = (*((uint64_t*)buf));
|
||||
#ifdef VERBOSE
|
||||
if (!index) cprintf(MAGENTA,"DataStreamer %d: fnum:%lld\n", index, (long long int)fnum);
|
||||
#endif
|
||||
|
||||
if (!measurementStartedFlag) {
|
||||
#ifdef VERBOSE
|
||||
if (!index) cprintf(MAGENTA,"DataStreamer %d: fnum:%lld\n", index, (long long int)fnum);
|
||||
#endif
|
||||
RecordFirstIndices(fnum);
|
||||
//restart timer
|
||||
clock_gettime(CLOCK_REALTIME, &timerBegin);
|
||||
//to send first image
|
||||
currentFreqCount = *streamingFrequency;
|
||||
}
|
||||
|
||||
//skip
|
||||
if (!(*streamingFrequency)) {
|
||||
if (!CheckTimer())
|
||||
return;
|
||||
} else {
|
||||
if (!CheckCount())
|
||||
return;
|
||||
}
|
||||
|
||||
if(!SendHeader(fnum))
|
||||
cprintf(RED,"Error: Could not send zmq header for fnum %lld and streamer %d\n",
|
||||
(long long int) fnum, index);
|
||||
|
||||
|
||||
Send Datat();
|
||||
}
|
||||
|
||||
bool DataStreamer::CheckTimer() {
|
||||
struct timespec end;
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
#ifdef VERBOSE
|
||||
cprintf(BLUE,"%d Timer elapsed time:%f seconds\n", index, ( end.tv_sec - timerBegin.tv_sec ) + ( end.tv_nsec - timerBegin.tv_nsec ) / 1000000000.0);
|
||||
#endif
|
||||
//still less than streaming timer, keep waiting
|
||||
if((( end.tv_sec - timerBegin.tv_sec ) + ( end.tv_nsec - timerBegin.tv_nsec ) / 1000000000.0) < (streamingTimerInMs/1000))
|
||||
return false;
|
||||
|
||||
//restart timer
|
||||
clock_gettime(CLOCK_REALTIME, &timerBegin);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DataStreamer::CheckCount() {
|
||||
if (currentFreqCount == *streamingFrequency ) {
|
||||
currentFreqCount = 1;
|
||||
return true;
|
||||
}
|
||||
currentFreqCount++;
|
||||
return false;
|
||||
}
|
||||
|
||||
int DataStreamer::SendHeader(uint64_t fnum) {
|
||||
uint64_t frameIndex = fnum - firstMeasurementIndex;
|
||||
uint64_t acquisitionIndex = fnum - firstAcquisitionIndex;
|
||||
uint64_t subframeIndex = -1; /* subframe to be included in fifo buffer? */
|
||||
char buf[1000];
|
||||
int len = sprintf(buf, jsonHeaderFormat, jsonHeaderFormat_part1, acquisitionIndex, frameIndex, subframeIndex,completeFileName[ithread]);
|
||||
return zmqSocket->SendDataOnly(buf, len);
|
||||
}
|
||||
|
@ -16,7 +16,8 @@ int Fifo::NumberofFifoClassObjects(0);
|
||||
Fifo::Fifo(uint32_t fifoItemSize, uint32_t fifoDepth, bool &success):
|
||||
memory(0),
|
||||
fifoBound(0),
|
||||
fifoFree(0) {
|
||||
fifoFree(0),
|
||||
fifoStream(0){
|
||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
||||
index = NumberofFifoClassObjects++;
|
||||
if(CreateFifos(fifoItemSize, fifoDepth) == FAIL)
|
||||
@ -41,6 +42,7 @@ int Fifo::CreateFifos(uint32_t fifoItemSize, uint32_t fifoDepth) {
|
||||
//create fifos
|
||||
fifoBound = new CircularFifo<char>(fifoDepth);
|
||||
fifoFree = new CircularFifo<char>(fifoDepth);
|
||||
fifoStream = new CircularFifo<char>(fifoDepth);
|
||||
//allocate memory
|
||||
memory = (char*) calloc (fifoItemSize * fifoDepth, sizeof(char));
|
||||
if (memory == NULL){
|
||||
@ -75,6 +77,10 @@ void Fifo::DestroyFifos(){
|
||||
delete fifoFree;
|
||||
fifoFree = 0;
|
||||
}
|
||||
if (fifoStream) {
|
||||
delete fifoStream;
|
||||
fifoStream = 0;
|
||||
}
|
||||
if(memory) {
|
||||
free(memory);
|
||||
memory = 0;
|
||||
@ -82,15 +88,14 @@ void Fifo::DestroyFifos(){
|
||||
}
|
||||
|
||||
|
||||
void Fifo::FreeAddress(char*& address) {
|
||||
while(!fifoFree->push(address));
|
||||
}
|
||||
|
||||
void Fifo::GetNewAddress(char*& address) {
|
||||
fifoFree->pop(address);
|
||||
}
|
||||
|
||||
void Fifo::FreeAddress(char*& address) {
|
||||
while(!fifoFree->push(address));
|
||||
}
|
||||
|
||||
void Fifo::PushAddress(char*& address) {
|
||||
while(!fifoBound->push(address));
|
||||
}
|
||||
@ -99,3 +104,11 @@ void Fifo::PopAddress(char*& address) {
|
||||
fifoBound->pop(address);
|
||||
}
|
||||
|
||||
void Fifo::PushAddressToStream(char*& address) {
|
||||
while(!fifoStream->push(address));
|
||||
}
|
||||
|
||||
void Fifo::PopAddressToStream(char*& address) {
|
||||
fifoStream->pop(address);
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "genericSocket.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <errno.h>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
|
||||
@ -28,7 +29,7 @@ pthread_mutex_t Listener::Mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
const GeneralData* Listener::generalData(0);
|
||||
|
||||
|
||||
Listener::Listener(Fifo*& f, runStatus* s, uint32_t* portno, char* e) :
|
||||
Listener::Listener(Fifo*& f, runStatus* s, uint32_t* portno, char* e, int* act, uint64_t* nf) :
|
||||
ThreadObject(NumberofListeners),
|
||||
fifo(f),
|
||||
acquisitionStartedFlag(false),
|
||||
@ -37,6 +38,8 @@ Listener::Listener(Fifo*& f, runStatus* s, uint32_t* portno, char* e) :
|
||||
udpSocket(0),
|
||||
udpPortNumber(portno),
|
||||
eth(e),
|
||||
activated(act),
|
||||
numImages(nf),
|
||||
numTotalPacketsCaught(0),
|
||||
numPacketsCaught(0),
|
||||
firstAcquisitionIndex(0),
|
||||
@ -53,7 +56,7 @@ Listener::Listener(Fifo*& f, runStatus* s, uint32_t* portno, char* e) :
|
||||
pthread_mutex_unlock(&Mutex);
|
||||
}
|
||||
NumberofListeners++;
|
||||
FILE_LOG (logDEBUG) << "Number of Listeners: " << NumberofListeners << endl;
|
||||
FILE_LOG (logDEBUG) << "Number of Listeners: " << NumberofListeners;
|
||||
}
|
||||
|
||||
|
||||
@ -74,16 +77,11 @@ uint64_t Listener::GetRunningMask() {
|
||||
return RunningMask;
|
||||
}
|
||||
|
||||
void Listener::SetGeneralData(GeneralData*& g) {
|
||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
||||
generalData = g;
|
||||
#ifdef VERY_VERBOSE
|
||||
generalData->Print();
|
||||
#endif
|
||||
void Listener::ResetRunningMask() {
|
||||
RunningMask = 0x0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** non static functions */
|
||||
/** getters */
|
||||
string Listener::GetType(){
|
||||
@ -150,12 +148,6 @@ void Listener::ResetParametersforNewMeasurement(){
|
||||
if (listeningPacket)
|
||||
delete listeningPacket;
|
||||
listeningPacket = new char[generalData->packetSize];
|
||||
|
||||
if(RunningMask){
|
||||
pthread_mutex_lock(&Mutex);
|
||||
RunningMask = 0x0;
|
||||
pthread_mutex_unlock(&Mutex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -172,17 +164,35 @@ void Listener::RecordFirstIndices(uint64_t fnum) {
|
||||
acquisitionStartedFlag = true;
|
||||
firstAcquisitionIndex = fnum;
|
||||
}
|
||||
if (!index) cprintf(MAGENTA,"%d First Acquisition Index:%lld\n"
|
||||
if (!index) cprintf(GREEN,"%d First Acquisition Index:%lld\n"
|
||||
"%d First Measurement Index:%lld\n",
|
||||
index, (long long int)firstAcquisitionIndex,
|
||||
index, (long long int)firstMeasurementIndex);
|
||||
}
|
||||
|
||||
|
||||
void Listener::SetGeneralData(GeneralData*& g) {
|
||||
generalData = g;
|
||||
#ifdef VERY_VERBOSE
|
||||
generalData->Print();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int Listener::SetThreadPriority(int priority) {
|
||||
struct sched_param param;
|
||||
param.sched_priority = priority;
|
||||
if (pthread_setschedparam(thread, SCHED_RR, ¶m) == EPERM)
|
||||
return FAIL;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int Listener::CreateUDPSockets() {
|
||||
ShutDownUDPSocket();
|
||||
|
||||
if (!(*activated))
|
||||
return OK;
|
||||
|
||||
//if eth is mistaken with ip address
|
||||
if (strchr(eth,'.') != NULL){
|
||||
strcpy(eth,"");
|
||||
@ -226,7 +236,7 @@ void Listener::ThreadExecution() {
|
||||
#endif
|
||||
|
||||
//udpsocket doesnt exist
|
||||
if (!udpSocket) {
|
||||
if (*activated && !udpSocket) {
|
||||
FILE_LOG(logERROR) << "Listening_Thread " << index << ": UDP Socket not created or shut down earlier";
|
||||
(*((uint32_t*)buffer)) = 0;
|
||||
StopListening(buffer);
|
||||
@ -234,17 +244,25 @@ void Listener::ThreadExecution() {
|
||||
}
|
||||
|
||||
//get data
|
||||
if (*status != TRANSMITTING)
|
||||
rc = ListenToAnImage(buffer + generalData->fifoBufferHeaderSize);
|
||||
if (*status != TRANSMITTING) {
|
||||
if (*activated)
|
||||
rc = ListenToAnImage(buffer + generalData->fifoBufferHeaderSize);
|
||||
else
|
||||
rc = CreateAnImage(buffer + generalData->fifoBufferHeaderSize);
|
||||
}
|
||||
|
||||
//done acquiring
|
||||
if (*status == TRANSMITTING) {
|
||||
if (*status == TRANSMITTING || ((!(*activated)) && (rc == 0))) {
|
||||
StopListening(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
//error check
|
||||
if (rc <= 0) cprintf(BG_RED,"Error:(Weird), UDP Sockets not shut down, but received nothing\n");
|
||||
if (rc <= 0) {
|
||||
cprintf(BG_RED,"Error:(Weird), UDP Sockets not shut down, but received nothing\n");
|
||||
fifo->FreeAddress(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
(*((uint32_t*)buffer)) = rc;
|
||||
(*((uint64_t*)(buffer + FIFO_HEADER_NUMBYTES ))) = currentFrameIndex;
|
||||
@ -311,22 +329,34 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
||||
|
||||
|
||||
//future packet
|
||||
if(fnum != currentFrameIndex) {
|
||||
if (fnum != currentFrameIndex) {
|
||||
carryOverFlag = true;
|
||||
memcpy(carryOverPacket,listeningPacket, generalData->packetSize);
|
||||
return generalData->imageSize;
|
||||
}
|
||||
|
||||
//copy packet and update fnum
|
||||
//copy packet
|
||||
memcpy(buf + (pnum * dsize), listeningPacket + generalData->headerSizeinPacket, dsize);
|
||||
(*((uint64_t*)(buf - FILE_FRAME_HEADER_SIZE))) = fnum;
|
||||
|
||||
}
|
||||
|
||||
return generalData->imageSize;
|
||||
}
|
||||
|
||||
|
||||
uint32_t Listener::CreateAnImage(char* buf) {
|
||||
|
||||
if (!measurementStartedFlag)
|
||||
RecordFirstIndices(0);
|
||||
|
||||
if (currentFrameIndex == *numImages)
|
||||
return 0;
|
||||
|
||||
//update parameters
|
||||
numPacketsCaught++; //record immediately to get more time before socket shutdown
|
||||
numTotalPacketsCaught++;
|
||||
|
||||
//reset data to -1
|
||||
memset(buf, 0xFF, generalData->dataSize);
|
||||
|
||||
return generalData->imageSize;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ void ThreadObject::RunningThread() {
|
||||
|
||||
ThreadExecution();
|
||||
|
||||
}/*--end of inner loop */
|
||||
}//end of inner loop
|
||||
|
||||
|
||||
//wait till the next acquisition
|
||||
@ -91,7 +91,7 @@ void ThreadObject::RunningThread() {
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
}/*--end of loop for each acquisition (outer loop) */
|
||||
}//end of outer loop
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,27 +13,24 @@
|
||||
|
||||
#include <cstdlib> //system
|
||||
#include <cstring> //strcpy
|
||||
#include <errno.h> //eperm
|
||||
using namespace std;
|
||||
|
||||
|
||||
/** cosntructor & destructor */
|
||||
|
||||
UDPStandardImplementation::UDPStandardImplementation() {
|
||||
|
||||
InitializeMembers();
|
||||
|
||||
}
|
||||
|
||||
|
||||
UDPStandardImplementation::~UDPStandardImplementation() {
|
||||
|
||||
DeleteMembers();
|
||||
}
|
||||
|
||||
|
||||
void UDPStandardImplementation::DeleteMembers() {
|
||||
|
||||
|
||||
if (generalData) { delete generalData; generalData=0;}
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
delete(*it);
|
||||
@ -51,8 +48,6 @@ void UDPStandardImplementation::DeleteMembers() {
|
||||
|
||||
|
||||
void UDPStandardImplementation::InitializeMembers() {
|
||||
|
||||
|
||||
UDPBaseImplementation::initializeMembers();
|
||||
acquisitionPeriod = SAMPLE_TIME_IN_NS;
|
||||
|
||||
@ -73,8 +68,6 @@ void UDPStandardImplementation::InitializeMembers() {
|
||||
/*** Overloaded Functions called by TCP Interface ***/
|
||||
|
||||
uint64_t UDPStandardImplementation::getTotalFramesCaught() const {
|
||||
|
||||
|
||||
uint64_t sum = 0;
|
||||
uint32_t flagsum = 0;
|
||||
|
||||
@ -91,8 +84,6 @@ uint64_t UDPStandardImplementation::getTotalFramesCaught() const {
|
||||
}
|
||||
|
||||
uint64_t UDPStandardImplementation::getFramesCaught() const {
|
||||
|
||||
|
||||
uint64_t sum = 0;
|
||||
uint32_t flagsum = 0;
|
||||
|
||||
@ -108,8 +99,6 @@ uint64_t UDPStandardImplementation::getFramesCaught() const {
|
||||
}
|
||||
|
||||
int64_t UDPStandardImplementation::getAcquisitionIndex() const {
|
||||
|
||||
|
||||
uint64_t sum = 0;
|
||||
uint32_t flagsum = 0;
|
||||
|
||||
@ -126,8 +115,6 @@ int64_t UDPStandardImplementation::getAcquisitionIndex() const {
|
||||
|
||||
|
||||
void UDPStandardImplementation::setFileFormat(const fileFormat f){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
switch(f){
|
||||
#ifdef HDF5C
|
||||
case HDF5:
|
||||
@ -147,8 +134,6 @@ void UDPStandardImplementation::setFileFormat(const fileFormat f){
|
||||
|
||||
|
||||
void UDPStandardImplementation::setFileName(const char c[]) {
|
||||
|
||||
|
||||
if (strlen(c)) {
|
||||
strcpy(fileName, c); //automatically update fileName in Filewriter (pointer)
|
||||
/*int detindex = -1;
|
||||
@ -169,8 +154,6 @@ void UDPStandardImplementation::setFileName(const char c[]) {
|
||||
|
||||
|
||||
int UDPStandardImplementation::setShortFrameEnable(const int i) {
|
||||
|
||||
|
||||
if (myDetectorType != GOTTHARD) {
|
||||
cprintf(RED, "Error: Can not set short frame for this detector\n");
|
||||
return FAIL;
|
||||
@ -193,6 +176,8 @@ int UDPStandardImplementation::setShortFrameEnable(const int i) {
|
||||
(*it)->SetGeneralData(generalData);
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->SetGeneralData(generalData);
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
(*it)->SetGeneralData(generalData);
|
||||
}
|
||||
FILE_LOG (logINFO) << "Short Frame Enable: " << shortFrameEnable;
|
||||
return OK;
|
||||
@ -200,8 +185,6 @@ int UDPStandardImplementation::setShortFrameEnable(const int i) {
|
||||
|
||||
|
||||
int UDPStandardImplementation::setFrameToGuiFrequency(const uint32_t freq) {
|
||||
|
||||
|
||||
if (frameToGuiFrequency != freq) {
|
||||
frameToGuiFrequency = freq;
|
||||
|
||||
@ -222,8 +205,6 @@ int UDPStandardImplementation::setFrameToGuiFrequency(const uint32_t freq) {
|
||||
|
||||
|
||||
int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
|
||||
|
||||
|
||||
if (dataStreamEnable != enable) {
|
||||
dataStreamEnable = enable;
|
||||
|
||||
@ -233,16 +214,27 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
|
||||
dataStreamer.clear();
|
||||
|
||||
if (enable) {
|
||||
for ( int i=0; i < numThreads; ++i ) {
|
||||
dataStreamer.push_back(new DataStreamer());
|
||||
if (DataStreamer::GetErrorMask()) {
|
||||
cprintf(BG_RED,"Error: Could not create data callback threads\n");
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
delete(*it);
|
||||
dataStreamer.clear();
|
||||
return FAIL;
|
||||
bool error = false;
|
||||
for ( int i = 0; i < numThreads; ++i ) {
|
||||
dataStreamer.push_back(new DataStreamer(fifo[i], &frameToGuiFrequency, &frameToGuiTimerinMS, &dynamicRange));
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
if (dataStreamer[i]->CreateZmqSockets() == FAIL) {
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (DataStreamer::GetErrorMask() || error) {
|
||||
if (DataStreamer::GetErrorMask())
|
||||
cprintf(BG_RED,"Error: Could not create data callback threads\n");
|
||||
else
|
||||
cprintf(BG_RED,"Error: Could not create zmq sockets\n");
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
delete(*it);
|
||||
dataStreamer.clear();
|
||||
dataStreamEnable = false;
|
||||
return FAIL;
|
||||
}
|
||||
SetThreadPriorities();
|
||||
}
|
||||
}
|
||||
FILE_LOG (logINFO) << "Data Send to Gui: " << dataStreamEnable;
|
||||
@ -251,8 +243,6 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
|
||||
|
||||
|
||||
int UDPStandardImplementation::setAcquisitionPeriod(const uint64_t i) {
|
||||
|
||||
|
||||
if (acquisitionPeriod != i) {
|
||||
acquisitionPeriod = i;
|
||||
|
||||
@ -273,8 +263,6 @@ int UDPStandardImplementation::setAcquisitionPeriod(const uint64_t i) {
|
||||
|
||||
|
||||
int UDPStandardImplementation::setAcquisitionTime(const uint64_t i) {
|
||||
|
||||
|
||||
if (acquisitionTime != i) {
|
||||
acquisitionTime = i;
|
||||
|
||||
@ -295,8 +283,6 @@ int UDPStandardImplementation::setAcquisitionTime(const uint64_t i) {
|
||||
|
||||
|
||||
int UDPStandardImplementation::setNumberOfFrames(const uint64_t i) {
|
||||
|
||||
|
||||
if (numberOfFrames != i) {
|
||||
numberOfFrames = i;
|
||||
|
||||
@ -317,8 +303,6 @@ int UDPStandardImplementation::setNumberOfFrames(const uint64_t i) {
|
||||
|
||||
|
||||
int UDPStandardImplementation::setDynamicRange(const uint32_t i) {
|
||||
|
||||
|
||||
if (dynamicRange != i) {
|
||||
dynamicRange = i;
|
||||
|
||||
@ -335,8 +319,6 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i) {
|
||||
|
||||
|
||||
int UDPStandardImplementation::setTenGigaEnable(const bool b) {
|
||||
|
||||
|
||||
if (tengigaEnable != b) {
|
||||
tengigaEnable = b;
|
||||
//side effects
|
||||
@ -352,8 +334,6 @@ int UDPStandardImplementation::setTenGigaEnable(const bool b) {
|
||||
|
||||
|
||||
int UDPStandardImplementation::setFifoDepth(const uint32_t i) {
|
||||
|
||||
|
||||
if (fifoDepth != i) {
|
||||
fifoDepth = i;
|
||||
|
||||
@ -368,8 +348,6 @@ int UDPStandardImplementation::setFifoDepth(const uint32_t i) {
|
||||
|
||||
|
||||
int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
||||
|
||||
|
||||
FILE_LOG (logDEBUG) << "Setting receiver type";
|
||||
|
||||
DeleteMembers();
|
||||
@ -415,8 +393,8 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
||||
|
||||
//create threads
|
||||
for ( int i=0; i < numThreads; ++i ) {
|
||||
listener.push_back(new Listener(fifo[i], &status, &udpPortNum[i], eth));
|
||||
dataProcessor.push_back(new DataProcessor(fifo[i], &status, &statusMutex, &fileFormatType, &fileWriteEnable,
|
||||
listener.push_back(new Listener(fifo[i], &status, &udpPortNum[i], eth, &activated, &numberOfFrames));
|
||||
dataProcessor.push_back(new DataProcessor(fifo[i], &fileFormatType, &fileWriteEnable, &dataStreamEnable,
|
||||
&callbackAction, rawDataReadyCallBack,pRawDataReady));
|
||||
if (Listener::GetErrorMask() || DataProcessor::GetErrorMask()) {
|
||||
FILE_LOG (logERROR) << "Error: Could not creates listener/dataprocessor threads (index:" << i << ")";
|
||||
@ -436,6 +414,9 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
(*it)->SetGeneralData(generalData);
|
||||
}
|
||||
|
||||
SetThreadPriorities();
|
||||
|
||||
FILE_LOG (logDEBUG) << " Detector type set to " << getDetectorType(d);
|
||||
return OK;
|
||||
}
|
||||
@ -444,7 +425,6 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
||||
|
||||
|
||||
void UDPStandardImplementation::setDetectorPositionId(const int i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
detID = i;
|
||||
FILE_LOG(logINFO) << "Detector Position Id:" << detID;
|
||||
@ -456,17 +436,19 @@ void UDPStandardImplementation::setDetectorPositionId(const int i){
|
||||
|
||||
|
||||
void UDPStandardImplementation::resetAcquisitionCount() {
|
||||
|
||||
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->ResetParametersforNewAcquisition();
|
||||
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->ResetParametersforNewAcquisition();
|
||||
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
(*it)->ResetParametersforNewAcquisition();
|
||||
|
||||
FILE_LOG (logINFO) << "Acquisition Count has been reset";
|
||||
}
|
||||
|
||||
|
||||
int UDPStandardImplementation::VerifyCallBackAction() {
|
||||
/** file path and file index not required?? or need to include detector index? do they need the datasize? its given for write data anyway */
|
||||
|
||||
@ -496,7 +478,6 @@ int UDPStandardImplementation::VerifyCallBackAction() {
|
||||
}
|
||||
|
||||
int UDPStandardImplementation::startReceiver(char *c) {
|
||||
|
||||
ResetParametersforNewMeasurement();
|
||||
|
||||
//listener
|
||||
@ -541,7 +522,6 @@ int UDPStandardImplementation::startReceiver(char *c) {
|
||||
|
||||
|
||||
void UDPStandardImplementation::stopReceiver(){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||
FILE_LOG(logINFO) << "Stopping Receiver";
|
||||
|
||||
//set status to transmitting
|
||||
@ -554,7 +534,9 @@ void UDPStandardImplementation::stopReceiver(){
|
||||
while(DataProcessor::GetRunningMask()){
|
||||
usleep(5000);
|
||||
}
|
||||
|
||||
while(DataStreamer::GetRunningMask()){
|
||||
usleep(5000);
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&statusMutex);
|
||||
status = RUN_FINISHED;
|
||||
@ -579,6 +561,8 @@ void UDPStandardImplementation::stopReceiver(){
|
||||
cprintf(GREEN, "Last Frame Number Caught :%lld\n",(long long int)listener[i]->GetLastFrameIndexCaught());
|
||||
}
|
||||
}
|
||||
if(!activated)
|
||||
cprintf(RED,"Note: Deactivated Receiver\n");
|
||||
//callback
|
||||
if (acquisitionFinishedCallBack)
|
||||
acquisitionFinishedCallBack((int)(tot/numThreads), pAcquisitionFinished);
|
||||
@ -597,8 +581,6 @@ void UDPStandardImplementation::stopReceiver(){
|
||||
|
||||
|
||||
void UDPStandardImplementation::startReadout(){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||
|
||||
if(status == RUNNING){
|
||||
|
||||
//needs to wait for packets only if activated
|
||||
@ -647,7 +629,6 @@ void UDPStandardImplementation::startReadout(){
|
||||
|
||||
|
||||
void UDPStandardImplementation::shutDownUDPSockets() {
|
||||
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->ShutDownUDPSocket();
|
||||
}
|
||||
@ -655,7 +636,6 @@ void UDPStandardImplementation::shutDownUDPSockets() {
|
||||
|
||||
|
||||
void UDPStandardImplementation::closeFiles() {
|
||||
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->CloseFiles();
|
||||
}
|
||||
@ -663,8 +643,6 @@ void UDPStandardImplementation::closeFiles() {
|
||||
|
||||
|
||||
void UDPStandardImplementation::SetLocalNetworkParameters() {
|
||||
|
||||
|
||||
//to increase socket receiver buffer size and max length of input queue by changing kernel settings
|
||||
if (myDetectorType == EIGER)
|
||||
return;
|
||||
@ -691,10 +669,46 @@ void UDPStandardImplementation::SetLocalNetworkParameters() {
|
||||
|
||||
|
||||
|
||||
void UDPStandardImplementation::SetThreadPriorities() {
|
||||
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it){
|
||||
if ((*it)->SetThreadPriority(LISTENER_PRIORITY) == FAIL) {
|
||||
FILE_LOG(logWARNING) << "Unable to prioritize threads. Root privileges required for this option.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it){
|
||||
if ((*it)->SetThreadPriority(PROCESSOR_PRIORITY) == FAIL) {
|
||||
FILE_LOG(logWARNING) << "Unable to prioritize threads. Root privileges required for this option.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
|
||||
if ((*it)->SetThreadPriority(STREAMER_PRIORITY) == FAIL) {
|
||||
FILE_LOG(logWARNING) << "Unable to prioritize threads. Root privileges required for this option.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
struct sched_param tcp_param;
|
||||
tcp_param.sched_priority = TCP_PRIORITY;
|
||||
if (pthread_setschedparam(pthread_self(),5 , &tcp_param) != EPERM) {
|
||||
FILE_LOG(logWARNING) << "Unable to prioritize threads. Root privileges required for this option.";
|
||||
return;
|
||||
}
|
||||
|
||||
ostringstream osfn;
|
||||
osfn << "Priorities set - "
|
||||
"TCP:"<< TCP_PRIORITY <<
|
||||
", Listener:" << LISTENER_PRIORITY <<
|
||||
", Processor:" << PROCESSOR_PRIORITY;
|
||||
if (dataStreamEnable)
|
||||
osfn << ", Streamer:" << STREAMER_PRIORITY;
|
||||
|
||||
FILE_LOG(logINFO) << osfn.str();
|
||||
}
|
||||
|
||||
|
||||
int UDPStandardImplementation::SetupFifoStructure() {
|
||||
|
||||
|
||||
|
||||
//recalculate number of jobs & fifodepth, return if no change
|
||||
if ((myDetectorType == GOTTHARD) || (myDetectorType == PROPIX)) {
|
||||
|
||||
@ -747,6 +761,7 @@ int UDPStandardImplementation::SetupFifoStructure() {
|
||||
//set the listener & dataprocessor threads to point to the right fifo
|
||||
if(listener.size())listener[i]->SetFifo(fifo[i]);
|
||||
if(dataProcessor.size())dataProcessor[i]->SetFifo(fifo[i]);
|
||||
if(dataStreamer.size())dataStreamer[i]->SetFifo(fifo[i]);
|
||||
}
|
||||
|
||||
FILE_LOG (logINFO) << "Fifo structure(s) reconstructed";
|
||||
@ -756,18 +771,21 @@ int UDPStandardImplementation::SetupFifoStructure() {
|
||||
|
||||
|
||||
void UDPStandardImplementation::ResetParametersforNewMeasurement() {
|
||||
Listener::ResetRunningMask();
|
||||
DataProcessor::ResetRunningMask();
|
||||
DataStreamer::ResetRunningMask();
|
||||
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->ResetParametersforNewMeasurement();
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->ResetParametersforNewMeasurement();
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
(*it)->ResetParametersforNewMeasurement();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int UDPStandardImplementation::CreateUDPSockets() {
|
||||
|
||||
|
||||
bool error = false;
|
||||
for (unsigned int i = 0; i < listener.size(); ++i)
|
||||
if (listener[i]->CreateUDPSockets() == FAIL) {
|
||||
@ -785,7 +803,6 @@ int UDPStandardImplementation::CreateUDPSockets() {
|
||||
|
||||
|
||||
int UDPStandardImplementation::SetupWriter() {
|
||||
|
||||
bool error = false;
|
||||
for (unsigned int i = 0; i < dataProcessor.size(); ++i)
|
||||
if (dataProcessor[i]->CreateNewFile(tengigaEnable,
|
||||
@ -805,8 +822,6 @@ int UDPStandardImplementation::SetupWriter() {
|
||||
|
||||
|
||||
void UDPStandardImplementation::StartRunning() {
|
||||
|
||||
|
||||
//set running mask and post semaphore to start the inner loop in execution thread
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it) {
|
||||
(*it)->StartRunning();
|
||||
@ -816,4 +831,8 @@ void UDPStandardImplementation::StartRunning() {
|
||||
(*it)->StartRunning();
|
||||
(*it)->Continue();
|
||||
}
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
|
||||
(*it)->StartRunning();
|
||||
(*it)->Continue();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user