|
Boost Users : |
Subject: Re: [Boost-users] [Interprocess] [file_mapping] is there any way to avoid writing a modified file to disc?
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2011-12-07 09:44:17
Den 07-12-2011 14:44, Dean Michael Berris skrev:
>>> Is there any way to avoid the file being saved after in-memory manipulation?
>>>
>>
>> In POSIX there's a way to say that a read/write region can be declared
>> private -- changes to it would not be propagated to the underlying
>> file. I don't see a way from the docs of providing the MAP_PRIVATE
>> flag to the call to mmap.
>>
>> Not sure if there's a similar concept in Windows.
>>
>
> Actually, I just checked the docs: it seems you want the
> 'copy_on_write' mode which combines PROT_WRITE|PROT_READ and
> MAP_PRIVATE. This allows you to make changes in place to the memory
> region without having the changes reflected to the original file.
Thanks. I overlooked that functionality. Anyway, I thought I had to use
managed_mapped_file
with
mapped_region
just like for file_mapping, but this doesn't work (compile error due to
missing function). Using managed_mapped_file alone segfaults.
Maybe this is something that is fixed in a later version than 1.45?
-Thorsten
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