I think I address this in the Coherence section on page 495.
But, in short, coherence is maintained between all instances of the same MMF and FlushFileBuffers does NOT have to be called. App#2 can just read the value after app #1 changes it and all is well.
-- Jeffrey Richter (http://Wintellect.com)
From:
Chen, Michael
Sent: Tuesday, February 19, 2008 11:34 PM
To: Jeffrey Richter (Wintellect LLC)
Subject: Question about the memory-mapped file after reading Windows via c/c++
To: Jeffrey Richter (Wintellect LLC)
Subject: Question about the memory-mapped file after reading Windows via c/c++
Hi Jeffrey,
Thanks for your another awesome version of your programming for windows series, which is Windows via c/c++.
After reading the contents about the chapter 17, which is about the memory-mapped file, and I’ve a instant question for you.
Here’s the scenario, let’s say, there’s a memory-mapped file in the disk and it contains an Integer value, 2 applications simply open it and map it into their application address respectively. If app#1 changed the value within the memory-mapped file then flushed the change into the disk file by calling FlushFileBuffer. What would happen to the view of memory-mapped file within the app#2? Can app#2 get the change immediately by re-get the value without reopen the file, or app#2 can’t be aware of the change until app#2 reopen/remaps the memory-mapped file?
Thanks,
Michael