3 Jul
2020
3 Jul
'20
7:11 a.m.
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.