Skip to content

jack_set_thread_creator() has no effect on the audio processing threads created by libjacknet.so #1020

Description

Describe the bug

The custom audio thread creator from jack_set_thread_creator() is not supported by netjack. One use of the custom thread creator is for Wine JACK applications, so valid Wine threads get created and used. Those applications crash if they try to use Wine calls when processing audio with netjack.

Environment

  • JACK Version: jackdmp version 1.9.22 tmpdir /dev/shm protocol 9
  • Operating System: Ubuntu Linux Ubuntu 26.04 LTS
  • Installation: installed via apt jackd2 and libjack-jackd2-dev

Steps To Reproduce

void create_wine_thread() { ... }
void net_process_callback() {...}

jack_set_thread_creator(create_wine_thread)

netjack = jack_net_slave_open
jack_set_net_slave_process_callback(netjack, net_process_callback)
jack_net_slave_activate(netjack)
/* processing starts... net_process_callback is not a wine thread, so cannot make wine calls */

Expected vs. actual behavior

I expected netjack to use the function passed to jack_set_thread_creator to be create its audio threads. Instead it uses the default pthread_create. Threads created in that way cannot be used by my Wine application, crashing it.

JackNetMasterManager::JackNetMasterManager in JackNetManager.cpp uses jack_client_create_thread() to build a thread for netjack audio. This function is wired to use JackGlobals::fJackThreadCreator to create threads with. A client to jack us allowed to set fJackThreadCreator to a custom function using jack_set_thread_creator().

The problem is that both libjack and libnetjack have independent copies of JackGlobals::fJackThreadCreator. So calling jack_set_thread_creator only changes threads created by libjack, not those created by libnetjack.

I can see two possible solutions:

  1. add jack_set_net_thread_creator(func) which sets libjacknet's version of JackGlobals::fJackThreadCreator
  2. add jack_get_thread_creator() to libjack, and use it in JackNetMasterManager::JackNetMasterManager
    This would allow JackGlobals to be removed from libjacknet, which seems like a win.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions