I am trying to have a real time Round Robin thread for my C++ sofware running in Ubuntu 16.04.
In the thread I have the following code:
void* thread1(void *){
struct sched_param param;
param.sched_priority = sched_get_priority_max(SCHED_RR);
if(pthread_setschedparam(0, SCHED_RR, ¶m)!=0){
cout<<"Error Setting Thread to Realtime..."<<endl;
}
}
The value pthread_setschedparam() return is 3 which I think the error is ESRCH according the the #define in the errno-base.h in the /usr/include/asm-generic/errno-base.h.
According to the man page (http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html) it says that
The thread whose ID is pid could not be found.
I am not sure how I can set that. Could any experience programmer give me some advice on this?
PS: I have followed the answer in this post Real-time programming with Linux and put my group into the realtime group in
/etc/security/limits.conf
Aucun commentaire:
Enregistrer un commentaire