Running MessageManager on non-main thread

I’m working on a JUCE-based shared library that is used in a larger Mac/Windows application.

For performance reasons I’d like to move the message manager thread of the library off of the application’s main thread. This works fine on Windows, but on Mac it fails immediately because the message pump is driven using NSApplication nextEventMatchingMask, which can only be called on the main thread.

Has anyone tried to solve this problem? Or does anyone with more Mac knowledge than me have any idea how hard it would be to accomplish this?

Thanks,
Ethan

Did you find any solution to this problem?

Thanks
Daniele

I did manage to solve/work around it somehow, but unfortunately I don’t have access to the code anymore (it was a client project), and I don’t remember the details! IIRC I had to turn off the JUCE_MODAL_LOOPS_PERMITTED setting. I also had to write a bit of code at the top level of my library to dispatch messages manually rather than rely on runDispatchLoop(), so that I could handle Windows/Mac a little differently. I think a few modifications to JUCE were required to get it all working but they weren’t big.

Sorry I can’t help more – good luck!

-Ethan