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:
- add jack_set_net_thread_creator(func) which sets libjacknet's version of JackGlobals::fJackThreadCreator
- 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.
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
Steps To Reproduce
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:
This would allow JackGlobals to be removed from libjacknet, which seems like a win.