简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM