CefQuitMessageLoop on MAC

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.

CefQuitMessageLoop on MAC

Postby Marcin » Wed Jun 24, 2015 3:15 am

Could someone pls guide me how should I call CefQuitMessageLoop on MAC in the following scenario.

I have plugin that is loaded by another app. During a load of my plugin I start a new thread which initializes Cef and performs message loop

Code: Select all
int myThread (int argc, char* argv[]) {

  CefMainArgs main_args(argc, argv);

 // Populate this structure to customize CEF behavior.
  CefSettings settings;

  // Specify the path for the sub-process executable.
  CefString(&settings.browser_subprocess_path).FromASCII(“/path/to/subprocess”);

  // Initialize CEF in the main process.
  CefInitialize(main_args, settings, app.get());

  // Run the CEF message loop. This will block until CefQuitMessageLoop() is called.
  CefRunMessageLoop();

  CefShutdown();
  return 0;
}

now, I have the same problem as I had in Windows version which I mentioned here: viewtopic.php?f=6&t=11389

so the question is how to call CefQuitMessageLoop as it has to be the same thread as the one which called CefInitialize. On Windows, I used hidden window, any hint how to achieve it on Mac ?
Marcin
Techie
 
Posts: 37
Joined: Fri Dec 06, 2013 5:07 am

Re: CefQuitMessageLoop on MAC

Postby magreenblatt » Mon Jul 06, 2015 12:57 pm

You can post a task to the CEF message loop and have that task execute CefQuitMessageLoop.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: CefQuitMessageLoop on MAC

Postby Marcin » Wed Jul 08, 2015 3:10 am

It worked as charm. I tried to achieve it with POSIX pthread_cancel and cleanup function but run into many problems I could not solve.

Thanks a lot Marshall
Marcin
Techie
 
Posts: 37
Joined: Fri Dec 06, 2013 5:07 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 64 guests