c# - Sharing a memory-mapped file from disk between processes -


I'm experiencing problems which seem trivial when using the Memory Mapping feature.

My goal is:

  • I have a file on disk, we say file.dat
  • I have two separate processes (they are one
  • Whatever is already started, it should be loaded into memory in the file, then use it for operation, the second process checks that Whether or not the file has been loaded on startup, it sees that it is actually, so it only works for its function I

Currently, I have seen the MemoryMappedFile.CreateFromFile function, however, this is a way to check whether some other process file Whether or not it is already loading in memory. In violation of the sharing violation in an attempt to load this file with two processes at the same time.

There is a CreateOrOpen function, but it is available only for non-permanent data which is not mine case. I have envisioned a mutex-like API, where the function will throw an exception on an attempt to create multiple files with the same name or do something similar. Obviously this approach has not been adopted in this matter, so what else can I use to accomplish my goal?


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -