[Jack-Devel] Helper threads with lower priority?

Robin Gareus robin at gareus.org
Sat Jun 29 20:49:13 CEST 2019

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 */ }


More information about the Jackaudio mailing list