System Q&A
Q: How to set the thread priority to RR99?
Reference code:
struct sched_param sched3; sched3.sched_priority = 99; pthread_create(&t3, NULL, (consumer), (void *)6); pthread_setname_np(t3,"TESTThread"); rc = pthread_setschedparam(t3, SCHED_RR, &sched3);
After setting, you can view it by cat /proc/pid/stat
:
Note: The pid belongs to the corresponding thread instead of the main thread. run htop, and then enter t to check it.
...