[Ace-users] [ace-users] Container classes in Shared Memory

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Thu Jan 17 18:46:43 CST 2008


Hi,

> I’m a newbie to ACE, just started about a week ago. I’ve been trying to create a common object for Inter Process
> Communication so that all processes running can post/receive messages from one another. It’s proving to be quite a
> difficult task and could use some help. I’m on a windows xp sp2 box using MS Visual Studio 05 to build ACE.

Welcome to ACE!  To ensure that we have proper version/platform/compiler
information, please make sure you fill out the appropriate problem
report form (PRF), which is in

$ACE_ROOT/PROBLEM-REPORT-FORM
$TAO_ROOT/PROBLEM-REPORT-FORM

or in

$ACE_ROOT/BUG-REPORT-FORM
$TAO_ROOT/BUG-REPORT-FORM

in older versions of ACE+TAO.  Make sure to include this information
when asking any questions about ACE+TAO since otherwise we have to
"guess" what version/platform/compiler/options you've using, which is
very error-prone and slows down our responsiveness.  If you don't use
the PRF, therefore, it is less likely that someone from the core
ACE+TAO developer team will be able to answer your question.
Naturally, we encourage and appreciate other members of the ACE+TAO
user community who can respond to questions that they have the answers
to.

> I can easily and successfully create a Hash map in shared memory using ACE_Hash_Map_With_Allocator holding my user defined
> class StaticQueue. With Two processes running I’m successful in finding each StaticQueue in the hash map. I can retrieve
> the bool value defined in the StaticQueue without a problem. However, the StaticQueue Class also has an ACE_Message_Queue*
> as a class variable. When I try to use this variable I receive memory access violations as runtime errors.
> 
>  In a single process I can create a StaticQueue in the hash map, Find the StaticQueue in the hash map, and Process the
> messages in the ACE message queue. However when I have 2 processes running one creates the StaticQueue, the other finds it
> but has an invalid pointer to the ACE_message_Queue.
> 
> Obviously, the memory for the ACE_Message_Queue is not in shared memory. Is it possible to create the ACE_Message_Queue’s
> memory in shared memory?

No, there's no (portable) way to do this since that class uses virtual
methods.  This is a C++ issue, not an ACE issue per se.  Please see the
discussions about this in C++NPv1 <www.cs.wustl.edu/~schmidt/ACE/book1>.

Thanks,

        Doug



More information about the Ace-users mailing list