Is having more than one message loop per process ok?


#1

It’s not really JUCE-related - I’ve done a library that does some HID-communication and there must be at least one message loop in the process that uses it. I’ve come across a user that wants to use it together with a well-known software, which has 2 processes that intercommunicate with sockets. The 2nd process of this software doesn’t have a message loop, but merely has its own loop.
Therefore I want to ask: Is it ok to add a thread into my library that gets started when the library gets started and that has a loop that looks like this (on OSX):

void messagepump(void *)
{
while(CFRunLoopRunInMode(kCFRunLoopDefaultMode,0,true) ==
kCFRunLoopRunHandledSource) {}
}

Certainly, most applications will already have a runloop, and so hence my library creates another one on a different thread, there will be 2. Does that hurt?


#2

Well, I think that’d be ok…