Boost logo

Boost Users :

From: Gavin Lambert (boost_at_[hidden])
Date: 2020-07-03 07:11:44


On 3/07/2020 18:01, Lloyd wrote:
> Does boost iostream mapped_file_source support concurrent read from
> multiple threads? What is the best way to implement concurrent read on a
> performance sensitive application?

I haven't used it myself, but as far as I can tell from skimming the
docs, as long as you open it beforehand and don't close it while the
threads are reading, then the actual read operations are immutable and
should be safe from any number of concurrent threads, since it's just
const memory read access.

If you construct a stream object around it, however, the stream will
definitely not be thread-safe. So each thread would need its own. Or
just access the mapped_file_source directly.


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