views:

78

answers:

1

Hi All, We are using boost::interprocess::managed_shared_memory. Recently while testing we found that after process crash threads searching in shared memory got stuck in manage_shared_memory APIs. My initial observation is that m_header recursive lock which is member of segment_manager was in locked state while process crashed and restarted. To overcome or fix such a scenario how actually we detect such condition.

Note: boost library version is 1_35_0

A: 

I always call boost::interprocess::named_upgradable_mutex::remove("mutex name"); prior to instantiating the mutex. If no other process is attached to the mutex it will be removed and you are guaranteed to have a clean state. If someone is attached to the mutex then it will just error.

MrEvil