Hello!

Because Wt::Dbo is synchronous, it often assumes most of time used by
Wt worker thread. Using "classical" async approach (passing callbacks)
is not convenient for Wt::Dbo. I propose change Wt event handlers into
co-programs, so that async code may be written as if sync.

C++11 provides lambdas and rvalue references, so Wt::Dbo API would not
be changed. C++11 is already in Debian stable and MSVC 2012.

Some changes required in Wt core. WApplication::notify (or some
private Wt function, more general) should run as co-program, then all
user code (not sure for WResource::handleRequest) would run inside
co-program. Maybe this can be done be reimplementing
WApplication::notify (without changes in Wt).

New public methods: WIOService (or other class, maybe WApplication or
WServer) provides method defer(function<void(const Error&)>). This
methods "pauses" co-program, asynchronously execute function passed
and resume current co-program.

Co-programs may be implementedon top of boost_context or
boost_coprogram. Boost_context is a dependency, so all this should be
done as CMake feature, which can be switched off.

References:
https://bitbucket.org/gridem/synca Three HTTP-servers: sync, async
(callbacks), synca (async + co-programs).
http://habrahabr.ru/post/201826/ (in Russian) Overhead of co-programs
was estimated as 5% for doing-nothing server, for servers with payload
it should be less.

Regards,
Boris Nagaev

------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to