Al Kurlansky
Al Kurlansky

Reputation: 307

boost::interprocess shared memory

My environment is Windows 2008/2012 C++ VS2013. I want an stl map to persist afte a warm restart. Would using boost:interprocess be a solution where the application that restarts is the server side making updates to the map and another client app would be connected to the same shared mem segment just to keep it "alive", if and when the server app crashes/restarts for any reason?

Upvotes: 1

Views: 88

Answers (1)

sehe
sehe

Reputation: 392843

Yes you can do this.

You can employ interprocess::shared_ptr<> to get the reference counting you suggest.

Keep in mind that mapped memory is not magically transactional so in case of hard failure there will be potential for corruption. Use a proper database persistence provider if you need robust state persistence.

Upvotes: 2

Related Questions