![]() |
Boost : |
From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2005-09-02 07:28:31
Hi Rob,
--- Rob Stewart <stewart_at_[hidden]> wrote:
> Was that 100 bytes per async call or per type of call?
Per type of call/callback handler combination.
> As I understand it, you have a class template derived from
> win_iocp_operation.
Several class templates, yes.
> Is it 100 bytes for each class created by
> specializing that template?
Yes, for each class that instantiates the template.
> Is there a reasonable upper bound on
> the number of such types in a given application?
No, I don't think so. An app can make as many asynchronous calls as it
wants using any combination of types for a callback handler. This even
includes things like call demuxer.post(...) to cause a deferred
invocation of a function object.
One of the strengths of an async I/O approach is that it makes it
relatively easy to compose new asynchronous operations from others. For
example, you might define a function:
template <typename Stream, typename Handler>
void async_read_mymsg(Stream& s, mymsg& m, Handler h);
which is is implemented internally using a chain of calls to async_read
or async_read_n. Each one of these internal async calls would require
its own win_iocp_operation-derived template instantiation, and each one
of those types would also be dependent on the Handler type. So in that
case the number of win_iocp_operation-derived template instantiations
would be the number of internal handlers x the number of different
handlers used with async_read_mymsg. And there could be further layers
of composition... you get the idea.
Cheers,
Chris
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk