[Jack-Devel] Helper threads with lower priority?

Johannes Lorenz j.spam at lorenz-ho.me
Sat Jun 29 23:42:38 CEST 2019


Cool, that worked!

I just added those lines to the simple_client.c, and now I get

$ ps -o cmd,pid,pri,ni,rtprio -T $(pidof simple_client)
CMD                           PID PRI  NI RTPRIO
./simple_client              9667  19   0      -
./simple_client              9667  19   0      -
./simple_client              9667  45   -      5
./simple_client              9667  45   -      5

Before adding the lines, there was only one "RTPRIO" thread. This proves 
it worked :)


Am 2019-06-29 20:49, schrieb Robin Gareus:
> On 6/29/19 8:32 PM, Johannes Lorenz wrote:
>> Thanks!
>> 
>>> Yes, see http://jackaudio.org/api/group__ClientThreads.html
>>> 
>>> libjack offers jack_client_create_thread(), which is useful for 
>>> helper
>>> threads.
>> 
>> Where should our DAW call this function? From inside the jack 
>> callback,
>> or from outside (e.g. by the `main()` thread)?
> 
> Creating threads is not realtime safe, so it must not be called from 
> the
> jack callback.
> 
> You usually create the threads at the same time when you connect to 
> jack
> and register the process callback, which is your main 
> application/engine
> thread, likely even main().
> 
> 
>> Also, what should we pass for the "priority" argument? Probably the
>> result of `jack_client_real_time_priority` for the already running
>> realtime thread?
> 
> Yes. Something like:
> 
> jack_client_t* jc;
> jack_native_thread_t tid;
> 
> if (jack_client_create_thread (
>       jc, &tid,
>       jack_client_real_time_priority (jc),
>       jack_is_realtime (jc),
>       start_worker_method, NULL)
>    ) { /* failed to create realtime thread */ }
> 
> 
> Cheers!
> robin
> _______________________________________________
> Jack-Devel mailing list
> Jack-Devel at lists.jackaudio.org
> http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org



More information about the Jackaudio mailing list