Given the following bit of code, I was wondering what the equivalent bit of code would be in linux assuming pthreads or even using the Boost.Thread API.
#include <windows.h>
int main()
{
SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_HIGHEST);
return 0;
}
The equivalent to
SetThreadPriorityin linux would bepthread_setschedprio(pthread_t thread, int priority).Check the man page.
EDIT: here’s the sample code equivalent:
This sample is for the default scheduling policy which is SCHED_OTHER.
EDIT: thread attribute must be initialized before usage.