Do some work while CefRunMessageLoop active

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Do some work while CefRunMessageLoop active

Postby newaira » Tue Jun 23, 2015 12:54 pm

Hi there!

Assuming I have an application such as cefsimple running, does anyone have any suggestion as to how I could have it communicate with another process? What I don't understand is how I can do any checks/work once CefRunMessageLoop is called, since it blocks the main thread until program is finished.

Would I need to spawn a separate thread that would take care of the communication (eg. sockets/pipes). Would this thread need to sync up with the main thread if I wanted to call something like CefBrowserHost::SendKeyEvent ?

Any suggestions are more than welcome.
newaira
Techie
 
Posts: 19
Joined: Sun Apr 19, 2015 7:43 pm

Re: Do some work while CefRunMessageLoop active

Postby amaitland » Tue Jun 23, 2015 7:29 pm

It's probably easier to execute your code in a separate thread and post tasks to the relevant CEF threads where required.

https://bitbucket.org/chromiumembedded/ ... ting-tasks

The API documentation is usually very specific about what methods need to be run on specific threads.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: Do some work while CefRunMessageLoop active

Postby newaira » Wed Jun 24, 2015 9:47 pm

Thanks, that makes a lot of sense.
newaira
Techie
 
Posts: 19
Joined: Sun Apr 19, 2015 7:43 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 17 guests