|
Boost : |
From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2005-12-22 05:58:18
Hi Simon,
Even though you've already left for the holidays, just for the
record...
--- simon meiklejohn <simon_at_[hidden]> wrote:
<snip>
> A naive approach (i.e. all that comes to mind for me) would
> be to add a virtual method to demuxer. Where currently
> demuxer is calling the Handler directly, instead pass it
> to the virtual function 'deliver_handler( Handler& handler )'.
>
> Then someone who wants gui delivery can create a class
> derived from asio::demuxer typedef, override deliver_handler
> manage their own internal queue of Handlers and create
> a cross-thread notification mechanism appropriate to the platform
>
> The virtual function would impose a cost on all platforms
> so perhaps a special purpose demuxer base class could
> be created (special policy perhaps) intended for derivation.
> e.g. asio::forwarding_demuxer
I'll investigate using something similar to my proposed custom
allocation hook for this. E.g.:
template <typename Handler>
class handler_dispatch_hook
{
public:
template <typename Demuxer, typename Function_Object>
static void dispatch(Demuxer& d, Handler& h,
Function_Object& f)
{
f();
}
};
Or something like that anyway.
Hope you enjoy your break.
Cheers,
Chris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk