Opened 9 years ago

Last modified 9 years ago

#9792 new Bugs

named_mutex is not process Persistence by default in windows

Reported by: huyuguang@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

when the BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION is defined, the named_mutex is ipcdetail::shm_named_mutex and is not process persistence.

BTW: when we can remove the BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION?

Change History (1)

comment:1 by huyuguang@…, 9 years ago

I am so sorry, the named_mutex is kernel/filesystem persistence and the interprocess_mutex is process persistence.

So how can I get a named mutex which is process persistence?

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() {

mutex1 = create_mutex("mutex1"); if (!mutex1) {

mutex1 = open_mutex("mutex1"); if (!mutex1)

return false;

managed_shared_memory segment(open_only,"mem1");

} else {

shared_memory_object::remove("mem1"); managed_shared_memory segment(create_only,"mem1");

} return true;

}

Note: See TracTickets for help on using tickets.