Other libraries that use the message loop in LibCinder update() method

I am trying to integrate CEF into a Cinder application on macOS.

I have everything hooked up and my app runs and sometimes, for a few frames, things work as expected and I see web content rendered in my app then the Cinder update() function stops being called.

I think the issue is that I call into my CEF library consumes and empties the message loop so there is nothing left for Cinder to process.

I didn’t see anything CEF related here but has anyone else come across this kind of issue and found a solution or workaround ?

I have no experience with CEF, but I remember others have tried integrating it into cinder earlier. Some pointers that might help:


Thanks for those pointers. I was excited to read the source for the sample you mentioned but sadly it uses CEF with a multithreaded message loop which is not possible for my use case. That’s why they don’t need to call a CEF update function in their Cinder app’s update() method.

If there is a way in LibCinder to regularly call another function, outside of update(), that might help me - calling the CEF update method in mousemove(…) for example does the right thing when you move the mouse.

Using a thread maybe?
Basic solution running until the app exists:

void callRegularly( std::function< void( void ) > fn, unsigned int sleepDuration )
            [ fn, sleepDuration ]()
                while ( true )
                    std::this_thread::sleep_for( std::chrono::milliseconds( sleepDuration ) );
            } ).detach();

initialize a lambda function called regularly like this:

callRegularly( [ this ]() { app::console() << getElapsedSeconds() << std::endl; }, 10 );

Thank you! - I already tried something similar but less elegant than your suggestion.

I added your code in case I’d missed something but the CEF update() function need to run in the same thread as the app it seems.

Currently looking at CEF source code to try to figure out what’s going on but it’s pretty hard-going.

So I replaced the calls to my wrapper library with raw CEF calls and now it’s clear that calling CefDoMessageLoopWork()in the overridden Cinder update() method causes the whole app to stop working.

Shame as it would have been a nice way to write cross-platform OpenGL test apps but I’ll have to look for something else.