I'm trying to write an application that opens a memory-mapped file and reads it every time new data is coming from other application.
My question is how my application knows when the new data comes in to read, or it's just continuously looping and read and hope some day it will see new data?
What kind of mechanism Windows provides to deal with repeatedly read of memory-mapped file.
Thanks,
You can have the program that is updating the memory mapped file raise an event when it writes new data, and have the other program subscribe to that event. It would then read from the memory map when it receives an event notification.
There is a sample project in MSDN that shows how to do this
https://code.msdn.microsoft.com/windowsdesktop/Inter-process-communication-e96e94e7