rxr: switched to threads for threadObject (from pthread), moved priorities to threadObject, mutex

This commit is contained in:
2019-11-29 16:19:02 +01:00
parent 16bec25b0c
commit 1a8337540a
11 changed files with 75 additions and 285 deletions

View File

@@ -30,7 +30,7 @@ DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo* f,
bool* fp, bool* act, bool* depaden, bool* sm, bool* qe,
std::vector <int> * cdl, int* cdo, int* cad) :
ThreadObject(ind),
ThreadObject(ind, TypeName),
runningFlag(false),
generalData(nullptr),
fifo(f),
@@ -62,7 +62,6 @@ DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo* f,
rawDataModifyReadyCallBack(nullptr),
pRawDataReady(nullptr)
{
ThreadObject::CreateThread();
FILE_LOG(logDEBUG) << "DataProcessor " << ind << " created";
memset((void*)&timerBegin, 0, sizeof(timespec));
}
@@ -71,13 +70,9 @@ DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo* f,
DataProcessor::~DataProcessor() {
delete file;
delete [] tempBuffer;
ThreadObject::DestroyThread();
}
/** getters */
std::string DataProcessor::GetType(){
return TypeName;
}
bool DataProcessor::IsRunning() {
return runningFlag;
@@ -155,20 +150,6 @@ void DataProcessor::SetGeneralData(GeneralData* g) {
}
void DataProcessor::SetThreadPriority(int priority) {
struct sched_param param;
param.sched_priority = priority;
if (pthread_setschedparam(thread, SCHED_FIFO, &param) == EPERM) {
if (!index) {
FILE_LOG(logWARNING) << "Could not prioritize dataprocessing thread. "
"(No Root Privileges?)";
}
} else {
FILE_LOG(logINFO) << "Priorities set - DataProcessor: " << priority;
}
}
void DataProcessor::SetFileFormat(const fileFormat f) {
if ((file != nullptr) && file->GetFileType() != f) {
//remember the pointer values before they are destroyed