在我的插件中,我想启动新线程并从中获取回调:
我有
function myCallback()
我想从插件中的线程每 2 秒调用一次。
我该怎么做?
// this method calls from html-page:
void MyFirstPluginAPI::testEvent()
{
//fire_test();
// thread starting:
boost::thread my_thread(boost::bind(&MyFirstPluginAPI::hello_world, this));
}
void MyFirstPluginAPI::hello_world()
{
for(;;)
{
boost::posix_time::seconds SleepTime(2);
boost::this_thread::sleep(SleepTime);
// here i must call InvokeAsync("myCallback",FB::variant_list_of(0));
// how can i to do it?
}
}
非常感谢。