- shared memory
- Posted by Cary Lewis on September 26th, 2003
When two processes are using shared memory to communicate, and the
CreateFileMapping with PAGE_READWRITE option is used, then
are the two processes guaranteed to have serial access to the memory.
i.e. if one is writing and one is reading, does the reader get a clean
copy of the data.
Or, do you have to use mutexes to control access to the shared memory
to avoid problems?
Thanks.
- Posted by Scott McPhillips [MVP] on September 27th, 2003
Cary Lewis wrote:
You have to use mutexes or other techniques to synchronize access
yourself.
--
Scott McPhillips [VC++ MVP]
- Posted by Cary Lewis on September 28th, 2003
"Scott McPhillips [MVP]" <scottmcp@mvps.org> wrote in message news:<hj6dnUZh2M49SumiXTWJjw@comcast.com>...
That is what I thought, the MSDN documenation is vague on this. There
is an article that refers to "no special synronization is required,
unless there is more than one writer".
I thought that maybe because the memory mapping was abstraced through
the file system, that there was some inherent protection offered by
the operating / file system.
To be safe, and more portable the use of mutexes seems prudent.
Thank you for your quick reply.
What is your role at Microsoft?
- Posted by Scott McPhillips [MVP] on September 29th, 2003
Cary Lewis wrote:
This is a hobby. I just like answering VC questions in newsgroups :-)
MVP is an award from Microsoft to volunteers who do this a lot:
http://mvp.support.microsoft.com/
--
Scott McPhillips [VC++ MVP]