I'm somewhat new to JUCE, and I'm trying to setup my plugin with a websocket server. Because libwebsockets wants a blocking poll loop on the main thread, I've build a cmd line juce application that acts as a server, and I'm trying to start it as a child process and open communications to it. Unfortunately, things are hanging on startup, and I'm not sure what could be wrong
My code to launch the child process is based on the juce demo application (Inside of a class I'm instantiating during main plugin instantiation)
After some further investigation, I've discovered that the child process is actually starting, but it's locking the main thread. Is there something I have to do to stop my child process from blocking the thread it's launched from?
My child process runs a blocking loop (a while loop that never exits). When I launch my child process, whatever thread I launch it from locks until the child process exits. Is that normal behavior, or have I set something up wrong?
I've discovered now that the process is hanging when I'm attempting to send messages to the child process. Right now, the child process (which is sitting inside of a while loop on the main thread) never services its message queue, or yields the main thread. Is it possible that I'm hanging the master process by locking up the main thread of the child while sending messages?
Well yes - obviously if your child process never allows the message loop to run, then it can't receive any messages. There's never a good reason to block the message thread - put any extended processing on a background thread instead.