Boost logo

Boost :

Subject: Re: [boost] [interprocess] Sharing shared_memory_object across processes?
From: Joseph Van Riper (fleeb.fantastique_at_[hidden])
Date: 2012-04-26 15:51:10

2012/4/26 Ion Gaztañaga <igaztanaga_at_[hidden]>

Sorry, but in your test the reader deletes mutexes in use and creates them
> again with the same name. This means that the writer and the reader don't
> shared the same mutex!

Ah, I misunderstood the behavior of ::remove(). I think I wrongly assumed
the file would not be removed if the mutex and shared_memory_object was in
use. I am not sure what lead me to think that, as logically, the behavior
you describe makes sense.

Humm... if I remove all the ::remove() calls (even for the
shared_memory_object) from both the reader and writer code, this works
without any changes to interprocess, and I can safely start and stop either
reader or writer process at any point, in any order. That's the behavior I

I suppose I'll need to resort to some other kind of mechanism for ensuring
the memory mapped files (shared memory and mutexes) are removed should all
processes using these objects stop running. Even with your suggested
changes, I haven't figured out how to remove the files safely.

Many thanks for the help here, Ion.

Boost list run by bdawes at, gregod at, cpdaniel at, john at