Ingo Molnar writes: > * Jack O'Quin wrote: > >> Is it possible to call sched_setscheduler() with a thread ID instead >> of a pid? That's what I really need. JACK sets and resets the thread >> priorities from a different thread. > > yes. The PID arguments in these APIs are all treated as 'TIDs'. One day > the APIs themselves might switch over to what POSIX specifies, and there > will be new, thread-specific APIs - but at the moment they are all > thread-granular. In the absence of any documentation, I'm guessing about storing the nice value in the priority field of the sched_param struct. But, I have not been able to figure out how to make that work. While intializing the "realtime" thread, I modified JACK to do this instead of setting SCHED_FIFO and the desired RT priority... policy = SCHED_OTHER; param.sched_priority = -20; Is that even a reasonable guess? It doesn't work. All the relevant pthread_xxx() services seem to return EINVAL given these values. When I change to use sched_setscheduler() instead of pthread_setschedparam(), I get ESRCH. Is the thread_t returned from pthread_create() different from the thread ID used by the kernel? If so, how do I obtain the right value? Is this stuff documented somewhere? How is anyone expected to use it? I'm attaching the relevant JACK thread.c source file, so you all can appreciate how much "fun" it is trying to do realtime programming under Linux. BTW, the #ifdef JACK_USE_MACH_THREADS parts are the Mac OS X version. Much cleaner, isn't it?