[linux-audio-dev] thread priority question
Paul Davis
paul at linuxaudiosystems.com
Wed Apr 30 12:52:01 UTC 2003
>Is there an equivalent to sched_setscheduler() that adjusts thread priority in
>stead of process priority? I want my audio thread to be higher priority than
>my drawing thread. Both threads are part of the same app (process). Is this
>possible in Linux v2.5?
from the source code of jack/libjack/client.c
if (pthread_attr_setschedpolicy (attributes, SCHED_FIFO)) {
jack_error ("cannot set FIFO scheduling class for RT thread");
return -1;
}
if (pthread_attr_setscope (attributes, PTHREAD_SCOPE_SYSTEM)) {
jack_error ("Cannot set scheduling scope for RT thread");
return -1;
}
memset (&rt_param, 0, sizeof (rt_param));
rt_param.sched_priority = client->engine->client_priority;
if (pthread_attr_setschedparam (attributes, &rt_param)) {
jack_error ("Cannot set scheduling priority for RT thread (%s)", strerror (errno));
return -1;
}
More information about the Linux-audio-dev
mailing list