[Ace-users] [ace-users] ACE_RW_Process_Mutex

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Fri Feb 29 08:14:48 CST 2008


Hi Kul,

Thanks for using the PRF.

> ACE VERSION: 5.5.8
> 
> HOST MACHINE and OPERATING SYSTEM:
> 
> Windows XP Professional
> 
> Version 2002
> 
> TARGET MACHINE and OPERATING SYSTEM, if different from HOST:NO
> 
> COMPILER NAME AND VERSION (AND PATCHLEVEL):
> 
> Visual studio 2005
> 
> THE $ACE_ROOT/ace/config.h FILE
> #include "ace/config-win32.h"
> 
> DOES THE PROBLEM AFFECT:
> 
>         COMPILATION?   NO
> 
>         LINKING?       NO
> 
>         EXECUTION?     YES
> 
>         OTHER  
> 
>     SYNOPSIS:
> 
> Using shared memory concept. I m using a "HashMap with Allocator"
> as a shared resource and trying to synchronize the same between
> "single writer and multiple readers" using a "ACE_RW_Process_Mutex".
> Please provide me with some sample application to understand the usage of ACE_RW_Process_Mutex syncronizing between multile
> readers and single writer.
> 
> DESCRIPTION:
> 
>  There is a single writer and multiple readers .
> 
> I used a "hash map with allocator" as a shared resource 
> 
> ( as given in 17.4.1 ,Page no 354 of ACE Programmers guide ).
> 
> when I am trying to synchronize the same between readers and 
> 
> writer using ACE_RW_process_Mutex named one ,the synchronization 
> 
> is not going properly.
> 
> I have given the name LIKE THIS
> 
> static const ACE_TCHAR * Mutexname=ACE_TEXT("hash-Map-Mutex")
> 
> ACE_RW_Process_mutex *RWMutex
> 
> RWMutex = new ACE_RW_Process_mutex(USYNC_PROCESS,Mutexname)
> 
> But when i run this it does take the name correctly.
> 
> Please provide me with some sample application to understand 
> 
> the usage of ACE_RW_Process_Mutex syncronizing between 
> 
> multile readers and single writer.

There are examples of ACE_Process_Mutex in

ACE_ROOT/tests/
ACE_ROOT/examples/Threads

that you should be able to adapt to use ACE_RW_Process_Mutex.  BTW,
please make sure you abide by the following constraint mentioned in
ACE_ROOT/ace/RW_Process_Mutex.h:

 * Note that because this class uses the
 * <ACE_File_Lock> as its implementation it only can be reliably
 * used between separate processes, rather than threads in the
 * same process.  This isn't a limitation of ACE, it's simply
 * the file lock semantics on UNIX and Win32.

Take care,

     Doug



More information about the Ace-users mailing list