Boost logo

Boost :

From: George M. Garner Jr. (gmgarner_at_[hidden])
Date: 2004-09-11 18:21:32


Johnathan,

> Now for some real fun. I am going to try and attach an overlapped filebuf
> to one of your
>> streams. :-)
>
> Good luck!
>

That worked without a hitch. But that is only because my overlapped_filebuf
uses blocking semantics. My original goal was to be able to transparently
interchange regular files and sockets as "sinks" and this will allow me to
do that. But the std stream and filebuf interfaces are really a
straight-jacket when it comes to more advanced applications, such as truly
asynchronous io; and the sooner we realize that the better. Imagine if, for
example, instead of doing write(char_type*, size_t) you could do
write(ref_string<char_type>&) or
write(ref_string_plus_overlapped<char_type>&). An observer could
transparently pass the buffer to the next layer without modification while
an asynchronous sink could take ownership of buffer by calling a swap()
member function and then pass the buffer to a waiting thread. The buffer
could grow or shrink as it passes from one filter to another. The buffer
could even pass in round robin fashion back to its origin if every observer
or filter called swap() in turn. But that is just a dream.

Regards,

George.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk