mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-29 17:40:01 +02:00
implemented SCHED_RR scheduling with priority in receiver-only if super user
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@490 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
d89e405748
commit
d205e79106
@ -736,6 +736,7 @@ void postProcessing::startThread(int delflag) {
|
|||||||
// param.sched_priority = 5;
|
// param.sched_priority = 5;
|
||||||
// scheduling parameters of main thread
|
// scheduling parameters of main thread
|
||||||
ret = pthread_setschedparam(pthread_self(), policy, &mparam);
|
ret = pthread_setschedparam(pthread_self(), policy, &mparam);
|
||||||
|
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
// printf("current priority is %d\n",param.sched_priority);
|
// printf("current priority is %d\n",param.sched_priority);
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
CC = g++
|
CC = g++
|
||||||
CLAGS += -DSLS_RECEIVER_FUNCTION_LIST -DGOTTHARDD #-DUHRIXCALLBACK #-DTESTWRITE
|
CLAGS += -DSLS_RECEIVER_FUNCTION_LIST -DGOTTHARDD #-DUHRIXCALLBACK #-DTESTWRITE
|
||||||
LDLIBS += -lm -lstdc++ -lpthread
|
LDLIBS += -lm -lstdc++ -lpthread
|
||||||
|
|
||||||
INCLUDES = -I ../MySocketTCP -I ../commonFiles -I ../usersFunctions -I ../slsDetectorAnalysis -I .
|
INCLUDES = -I ../MySocketTCP -I ../commonFiles -I ../usersFunctions -I ../slsDetectorAnalysis -I .
|
||||||
|
@ -189,7 +189,7 @@ int slsReceiverFunctionList::startReceiver(){
|
|||||||
listening_thread_running=1;
|
listening_thread_running=1;
|
||||||
|
|
||||||
|
|
||||||
//error creating writing thread
|
// creating writing thread
|
||||||
err = pthread_create(&writing_thread, NULL,startWritingThread, (void*) this);
|
err = pthread_create(&writing_thread, NULL,startWritingThread, (void*) this);
|
||||||
if(err){
|
if(err){
|
||||||
listening_thread_running=0;
|
listening_thread_running=0;
|
||||||
@ -201,7 +201,7 @@ int slsReceiverFunctionList::startReceiver(){
|
|||||||
cout << "Writing thread created successfully." << endl;
|
cout << "Writing thread created successfully." << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//error creating listenign thread
|
// creating listenign thread
|
||||||
err = 0;
|
err = 0;
|
||||||
err = pthread_create(&listening_thread, NULL,startListeningThread, (void*) this);
|
err = pthread_create(&listening_thread, NULL,startListeningThread, (void*) this);
|
||||||
if(err){
|
if(err){
|
||||||
@ -219,6 +219,27 @@ int slsReceiverFunctionList::startReceiver(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
cout << "Threads created successfully." << endl;
|
cout << "Threads created successfully." << endl;
|
||||||
|
|
||||||
|
|
||||||
|
struct sched_param tcp_param, listen_param, write_param;
|
||||||
|
int policy= SCHED_RR;
|
||||||
|
|
||||||
|
tcp_param.sched_priority = 50;
|
||||||
|
listen_param.sched_priority = 99;
|
||||||
|
write_param.sched_priority = 90;
|
||||||
|
|
||||||
|
|
||||||
|
if (pthread_setschedparam(listening_thread, policy, &listen_param) == EPERM)
|
||||||
|
cout << "ERROR: Could not prioritize threads. You need to be super user for that." << endl;
|
||||||
|
if (pthread_setschedparam(writing_thread, policy, &write_param) == EPERM)
|
||||||
|
cout << "ERROR: Could not prioritize threads. You need to be super user for that." << endl;
|
||||||
|
if (pthread_setschedparam(pthread_self(), policy, &tcp_param) == EPERM)
|
||||||
|
cout << "ERROR: Could not prioritize threads. You need to be super user for that." << endl;
|
||||||
|
|
||||||
|
|
||||||
|
pthread_getschedparam(listening_thread,&policy,&tcp_param);
|
||||||
|
cout << "current priority of main tcp thread is " << tcp_param.sched_priority << endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -274,14 +295,10 @@ int slsReceiverFunctionList::startListening(){
|
|||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
cout << "In startListening()\n");
|
cout << "In startListening()\n");
|
||||||
#endif
|
#endif
|
||||||
// Variable and structure definitions
|
|
||||||
int rc;
|
int rc;
|
||||||
// dataStruct *dataReadFrame;
|
|
||||||
|
|
||||||
//reset variables for each acquisition
|
|
||||||
startFrameIndex=-1;
|
startFrameIndex=-1;
|
||||||
|
|
||||||
|
|
||||||
// A do/while(FALSE) loop is used to make error cleanup easier. The
|
// A do/while(FALSE) loop is used to make error cleanup easier. The
|
||||||
// close() of each of the socket descriptors is only done once at the
|
// close() of each of the socket descriptors is only done once at the
|
||||||
// very end of the program.
|
// very end of the program.
|
||||||
@ -339,12 +356,6 @@ int slsReceiverFunctionList::startListening(){
|
|||||||
;//cout<<"**********************FIFO FULLLLLLLL************************"<<endl;
|
;//cout<<"**********************FIFO FULLLLLLLL************************"<<endl;
|
||||||
else{
|
else{
|
||||||
//cout<<"read index:"<<dec<<(int)(*(int*)buffer)<<endl;
|
//cout<<"read index:"<<dec<<(int)(*(int*)buffer)<<endl;
|
||||||
/** dataReadFrame = new dataStruct;
|
|
||||||
dataReadFrame->buffer=buffer;
|
|
||||||
dataReadFrame->rc=rc;
|
|
||||||
//cout<<"read buffer:"<<dataReadFrame<<endl;
|
|
||||||
fifo->push(dataReadFrame);
|
|
||||||
*/
|
|
||||||
fifo->push(buffer);
|
fifo->push(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,11 +399,8 @@ int slsReceiverFunctionList::startWriting(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *wbuf;
|
char *wbuf;
|
||||||
|
|
||||||
// Variable and structure definitions
|
|
||||||
int ret,sleepnumber=0;
|
int ret,sleepnumber=0;
|
||||||
//char *guiData;
|
|
||||||
//reset variables for each acquisition
|
|
||||||
framesInFile=0;
|
framesInFile=0;
|
||||||
framesCaught=0;
|
framesCaught=0;
|
||||||
frameIndex=0;
|
frameIndex=0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user