Boost logo

Boost Users :

Subject: [Boost-users] [interprocess] shared_memory_object constructor with create_only parameter
From: Philipp Hamann (philipp.hamann_at_[hidden])
Date: 2010-01-25 06:26:19


Hi all,
I have some problems using the shared_memory_object constructor with the
create_only parameter.
The goal is to allow only one process to write to the shared memory. So
I create a shared_memory_object with the create_only parameter. For the
first process this is successful (as I assumed), but for the second
process (same parameters) this is successful, too (not as I assumed).
The documentation of boost says that it should throw an exception, if
the shared memory is allready created. Is this a bug or a misuse or
understanding of the library?

I am using WinXP, boost 1.41 and MinGW 5.1.6.

Probably this is a problem concerning the special handling of the shared
memory using Windows?

I realized another problem. If I call the static function
shared_memory_object::remove(const char* name), the memory should be
removed only when no further process has access to the memory. This
seems also not to work. I did the following:
1. create shared memory for writing.
2. open shared memory for reading
3. shared_memory_object::remove(const char* name) (from the reading process)
4. reopen the shared memory for reading -> exception: can not find the file

Any suggestions to my issues?

Thanks in advance

     Philipp


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