Boost C++ Libraries: Ticket #9792: named_mutex is not process Persistence by default in windows https://svn.boost.org/trac10/ticket/9792 <p> when the BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION is defined, the named_mutex is ipcdetail::shm_named_mutex and is not process persistence. </p> <p> BTW: when we can remove the BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9792 Trac 1.4.3 huyuguang@… Wed, 19 Mar 2014 10:07:53 GMT <link>https://svn.boost.org/trac10/ticket/9792#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9792#comment:1</guid> <description> <p> I am so sorry, the named_mutex is kernel/filesystem persistence and the interprocess_mutex is process persistence. </p> <p> So how can I get a named mutex which is process persistence? </p> <p> What I need is I need to know if current process is the first process so that it can create a managed_shared_memory. Since the managed_shared_memory is kernel/filesystem persistence, if the processes crash, the file would still exist in folder. So I want to use a process persistence named mutex to avoid this, the code looks like: bool init() { </p> <blockquote> <p> mutex1 = create_mutex("mutex1"); if (!mutex1) { </p> <blockquote> <p> mutex1 = open_mutex("mutex1"); if (!mutex1) </p> <blockquote> <p> return false; </p> </blockquote> <p> managed_shared_memory segment(open_only,"mem1"); </p> </blockquote> <p> } else { </p> <blockquote> <p> shared_memory_object::remove("mem1"); managed_shared_memory segment(create_only,"mem1"); </p> </blockquote> <p> } return true; </p> </blockquote> <p> } </p> </description> <category>Ticket</category> </item> </channel> </rss>