c++boostshared-memoryinterprocess

Do the boost containers for shared memory implement locking?


I am trying to use the c++ boost library to create a hashmap in a (boost) shared memory location. So far so good, this is all nicely documented in the boost documentation. However, I want to have a mutex lock on the map I create but I cannot understand whether this is already part of the hashmap container.

I cannot find this information in the documentation and trying to read through the boost sources I quickly got lost, even google does not provide the answer. Of course it would be easy to implement a mutex lock using the boost library but I don't want to end up with a redundant locking mechanism.

If anyone could tell me whether the boost containers, hashmap in particular, come with locking included that would be very helpful. Bonus points if you can point me to the place on the www where I could have found this information myself.


Solution

  • The boost "containers for shared memory" are merely aliases for the general-purpose containers from Boost Container. In fact, they only become "for shared memory" when used with the appropriate allocator type(s).

    As such, they do not have synchronization built in (unless documented of course).