I have encountered some unexpected troubles while porting Windows application to MacOS. And i guess all other Unix-based systems too
The application is made of 2 processes:
1. First one is a GUI made with Juce that launches the second one
2. Second is a proprietory application with localhost socket interface.
The protocol description is public so i have a GUI implementing the interface in a convinient form.
I had no problems on Windows using CreateProcess inside JUCE_WINDOWS defines of the first app to start the second one. But there is a big problem on Mac .
I can't run fork in the first application due to MacOS fatal error (forking multi-threaded process). I tried to fork in the constructor of implemetation class that is derived from JUCEApplication.
- Code: Select all
class AppClass: public JUCEApplication
{
public:
AppClass()
{
int cpid =fork(); //forking in multi-threaded process
if(cpid == 0){
/* exec() something in child process */
exit(0);
}
}
...
}
Where is the best place to fork in Juce application?
Or should i make a third application that starts the first and the second application as its child processes?
Thanks in advance
