0
votes

may i know how can i create a periodic timer callback on main thread using Firebreath plugin framework? i tried FB::Timer::getTimer(1, true, EventRunLoop); on the StaticInitialize(). i noticed my EventRunLoop function does not run on main thread when i debug into the created dll plugin and break point into EventRunLoop, VC++ express 2008 always indicate me that I was inside worker thread instead of main thread.

I understand that FB:Timer is wrapper on boost::asio. To create async_wait using boost, I need the boost::asio::io_service io.run() function to be put into the main thread. But I have no idea to how actively access the main thread of NPAPI or Firebreath because all the functions created is much of event base.

1

1 Answers

1
votes

The recommended way is to use FB::Timer and then use m_host->scheduleOnMainThread to call back onto the main thread.

If you're only needing windows you could use WM_TIMER.

There are examples of just about all of this in the FBTestPlugin example in the FireBreath codebase