Boost logo

Boost Users :

Subject: [Boost-users] How to create array of boost::interprocess::interprocess_mutex in maped file
From: Alan Bus (pluscore_at_[hidden])
Date: 2012-08-03 21:59:35


I think here may be the good place to get some help or instruction. So I
post my question here. Thanks in advance.

I'd like to create array interprocess_mutex in mapped file, but don't know
how to do that. Could you give some hints are highly appreciated? Thanks in
advance! Following is my code snippet,

typedef boost::interprocess::interprocess_mutex TMutex;
managed_mapped_file *pMapFile = new
managed_mapped_file(open_or_create,
"/tmp/test.bin",1024UL*64UL*4096UL);

TMutex *pMutex = pMapFile->construct<TMutex>("MyMutex")[50](); // Not
sure here is right or not? TMutex **? How to declare for mutex array?

//If I'd like to refer to 2nd element of this array, how can I use it?
//pMutex[2] ? for example, scoped_lock<TMutex> lock<pMutex[2]>; // it crashed

Could you give some instruction on how to create mutex array and how to
access it by [] or other ways? Thank you very much.

-- 
sincerely,
Alan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net