Listing 2
#include <pthread.h> int start_thread_with_priority(pthread_t* thread, (*start_routine)(void*), void* arg) { struct pthread_attr_t attr; struct sched_param param; pthread_attr_init(&attr); pthread_attr_setschedpolicy(&attr, SCHED_RR); param.sched_priority = 50; pthread_attr_setschedparam(&attr, ¶m); return pthread_create(thread, &attr, start_routine, arg) }