开发者

How to replace WT's main loop with an ACE_Reactor

We have a project with a core functionality implemented using ACE, and architectured around it's Reactor. We want to add a small web inter开发者_如何学Pythonface using Wt.

So the question is, is it possible to replace the main loop of the wt interface with the ace reactor?

The only bad idea that comes to my mind is having a fast timer on the Reactor side which somehow invokes the wt part. The other way round, the reactor can be run 'tick by tick' using it's handle_events method but I can't find an equivalent on the wt side.

note: The main concern behind this question is about threads. We don't have threads, the code is not thread safe, and it would be a lot simpler for us if the HMI could be running on the same thread as the rest of the application. But having 2 blocking calls, one to theReactor->run_reactor_event_loop(), and the other to Wt::WRun() is a problem!


That can work with some modifications to the Wt connector. Wt can be compiled without thread support, so in the connector there must be a select() loop of some kind. What you need is the ability to hook into that loop with a timer.

Are you talking about the http connector? That's implemented with boost.asio, so an asio deadline_timer with an async_wait that executes theReactor->run_reactor_event_loop() may be all you need. Maybe you may even find a different idea when you dive into the boost.asio documentation...

It could even work without modifications to the connector. It's not documented, but Server::instance()->service() (in src/http/Server.h) returns you the asio service that you need to implement this.

More info -> Wt's mailing list?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜