I'm trying to create a vector of objects in shared memory that each own an interprocess_mutex as follows:
using namespace boost::interprocess;
managed_shared_memory seg(open_or_create, "MySharedMemory", 65536);
allocator<void, managed_shared_memory::segment_manager> void_alloc_(seg.get_segment_manager());
vector<test, allocator<test, managed_shared_memory::segment_manager>> vec(void_alloc_);
However interprocess_mutex is explicitly missing a copy/move constructor and clang fails to compile with this error:
copy constructor of 'test' is implicitly deleted because field 'mutex' has an inaccessible copy constructor
Is there a reason for this? It looks like boost::thread mutex has a copy constructor. How can I accomplish this using interprocess_mutex?