|
Boost : |
Subject: Re: [boost] ASIO into the standard (was: Re: C++ committee meeting report)
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2014-07-08 18:35:35
On 8 Jul 2014 at 7:34, pfultz2 wrote:
> > You might have a look at AFIO too :)
>
> I might take a look at that, but overall I don't really need async io.
> However, I did need the stream to be `Seekable`, that is, it would let me
> read
> and set the position in the file. I don't think this works really well with
> async io.
Async i/o has no concept of file position. You schedule read scatters
and write gathers to some file offset. They complete when the
conditions you have requested for the op are met.
It is of course extremely easy to add a file position using an
std::atomic<offset_t> :)
> I don't see sync stream as a problem really. A default timeout could be
> a property of the stream, rather than adding it to the read function.
> Ideally, it would be nice if there were facades that would make an async
> stream -> sync stream, and a sync stream -> async stream.
Sure, if it meets your requirements and doesn't eat data, it's a good
solution.
Unlike network i/o, timeouts have no place in file i/o. A file
operation will always either eventually complete, or eventually
return an error.
I have seen, during testing, a single read take over a minute to
complete, so timing that out would be bad as cancelling scheduled i/o
is unfortunately very non-portable (and can corrupt memory on
Windows).
Niall
-- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk