Boost C++ Libraries: Ticket #5266: mapped_region::flush improvement https://svn.boost.org/trac10/ticket/5266 <p> The function flush shoud be changed or made polymorf in order to have an ability to set sync flags of msync directly </p> <p> like this </p> <p> function mapped_region::flush(std::size_t mapping_offset, std::size_t numbytes, int flags) </p> <p> The following flags are defined for msync(): </p> <p> MS_ASYNC </p> <blockquote> <p> Perform asynchronous writes. </p> </blockquote> <p> MS_SYNC </p> <blockquote> <p> Perform synchronous writes. </p> </blockquote> <p> MS_INVALIDATE </p> <blockquote> <p> Invalidate mappings. </p> </blockquote> <p> this is critical for some applications that shoud be sure that data if fully transfered to the device. </p> <p> Thanks for help. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5266 Trac 1.4.3 Ion Gaztañaga Fri, 01 Apr 2011 17:25:26 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5266#comment:1 https://svn.boost.org/trac10/ticket/5266#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> Sorry, that wouldn't be portable for other platforms, so I'm afraid you'll need to call msync yourself with your custom params. </p> Ticket dan.eloff@… Mon, 09 Jan 2012 19:33:45 GMT status, version changed; resolution deleted https://svn.boost.org/trac10/ticket/5266#comment:2 https://svn.boost.org/trac10/ticket/5266#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.46.0</span> → <span class="trac-field-new">Boost Development Trunk</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">wontfix</span> </li> </ul> <p> How about an overload: </p> <p> mapped_region::flush(std::size_t mapping_offset, std::size_t numbytes, bool sync) </p> <p> which uses msycn(MS_SYNC) on posix systems and <a class="missing wiki">FlushViewOfFile</a> + <a class="missing wiki">FlushFileBuffers</a> on windows </p> <p> If there are platforms where it cannot be supported, flush with sync=true should throw an exception. </p> <p> This removes the burden of writing a multiple platform flush(..., sync=true) from the user, which this library does a great job of for other memory mapped file operations. That should cover all the common use cases. </p> Ticket Ion Gaztañaga Thu, 10 Jan 2013 19:25:51 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5266#comment:3 https://svn.boost.org/trac10/ticket/5266#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Implemented in Boost 1.51: </p> <p> bool flush(std::size_t = 0, std::size_t = 0, bool = true); </p> Ticket