Boost logo

Boost Users :

Subject: Re: [Boost-users] [interprocess] shared_memory_object constructor with create_only parameter
From: Philipp Hamann (philipp.hamann_at_[hidden])
Date: 2010-01-26 03:55:12


Hi all,

I am sorry. I made a mistake. My first problem is solved. It is not a bug.

> 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?

But the second problem concerning shared_memory_object::remove(const
char* name) is still present.

> 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

Thanks for your help and apoligizes for bothering you with my first problem.

   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