Opened 12 years ago
Closed 10 years ago
#5266 closed Feature Requests (fixed)
mapped_region::flush improvement
| Reported by: | Owned by: | Ion Gaztañaga | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | interprocess | 
| Version: | Boost Development Trunk | Severity: | Problem | 
| Keywords: | Cc: | 
Description
The function flush shoud be changed or made polymorf in order to have an ability to set sync flags of msync directly
like this
function mapped_region::flush(std::size_t mapping_offset, std::size_t numbytes, int flags)
The following flags are defined for msync():
MS_ASYNC
Perform asynchronous writes.
MS_SYNC
Perform synchronous writes.
MS_INVALIDATE
Invalidate mappings.
this is critical for some applications that shoud be sure that data if fully transfered to the device.
Thanks for help.
Change History (3)
comment:1 by , 12 years ago
| Resolution: | → wontfix | 
|---|---|
| Status: | new → closed | 
comment:2 by , 11 years ago
| Resolution: | wontfix | 
|---|---|
| Status: | closed → reopened | 
| Version: | Boost 1.46.0 → Boost Development Trunk | 
How about an overload:
mapped_region::flush(std::size_t mapping_offset, std::size_t numbytes, bool sync)
which uses msycn(MS_SYNC) on posix systems and FlushViewOfFile + FlushFileBuffers on windows
If there are platforms where it cannot be supported, flush with sync=true should throw an exception.
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.
comment:3 by , 10 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | reopened → closed | 
Implemented in Boost 1.51:
bool flush(std::size_t = 0, std::size_t = 0, bool = true);

Sorry, that wouldn't be portable for other platforms, so I'm afraid you'll need to call msync yourself with your custom params.