|
Boost Users : |
Subject: Re: [Boost-users] [boost.asio] Concurrently Ping 1000+ Hosts
From: Bjorn Reese (breese_at_[hidden])
Date: 2013-12-20 13:16:53
On 12/20/2013 05:31 PM, Niall Douglas wrote:
> Can you suggest something? I honestly can't think of anything simpler
> which also provides strong write ordering guarantees.
I have not given this much thought so consider the following a
brainstorm.
I am thinking about an API that uses handles that looks more like Asio
sockets. Write ordering can be handled, not by batching operations
together, but rather calling the next write operation from the callback
of the previous operation (Asio-style.) This will not always yield good
performance, but oftentimes that is less relevant. If you need
performance, then the "advanced" dispatcher API is available.
So there could be a file handle (and directory handle) class for file
(directory) manipulation calls, which hides all the details of the
dispatcher etc.
class file_handle
{
public:
void read(buffer, read_callback);
void write(buffer, write_callback);
// and so on
};
class directory_handle
{
public:
void create(name, create_callback); // uses file(single) or dir(single)
void remove(name, remove_callback); // uses rmdir(single)
void watch(name, watch_callback); // directory monitoring
// and so on
};
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net