Re: Sockets in C++?
On Apr 12, 6:50 am, gi3nos...@mariani.ws (Gianni Mariani) wrote:
John Nagle wrote:
Yes, that's right.
The basic concept of Boost's "asio" is that
"boost::asio::demuxer::run()"
owns the main event loop and calls everything else. That's a
framework, not a library.
Frameworks tend to take over the program design. Try using "asio".
and some GUI framework which also wants to own the event loop, in the
same program. Sometimes multiple frameworks can be made to play together
using multiple threads, but it's usually not easy.
That's why I'd argue against including something like "asio" in the
Standard C++ library. There's nothing wrong with creating frameworks,
but they're not library components.
What's all this phobia over call backs.
Not against callbacks per se, but against asynchronous
callbacks.
An event based model is congruous to a callback model.
Yes. The problem, as he clearly said, is making several event
based models work together in a single application.
In the latest (unreleased) version of Austria C++ - (alpha availablehttp://netcabletv.org/public_releases/), it contains a framework that
follows a callback paradigm. I have not found that it limits anything
in any way. (The callback interfaces are called twins in the Austria C++
impl).
Please explain what exactly is limiting in your mind ?
He just did. He objects to having a library component take over
the basic loop.
I'd have to agree with him there.
If the callbacks are based on a threading model; i.e. the event
control runs in its own thread, then you have to take into
account the fact that the user's callback may be (and probably
will be) called from a thread the user doesn't even know about,
and you have to provide a mechanism for the user to stop the
thread (which he doesn't know about) in order to ensure clean
shutdown.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient?e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S?mard, 78210 St.-Cyr-l'?cole, France, +33 (0)1 30 23 00 34
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]