[Ace-users] [ace-bugs] ACE_RW_Process_Mutex
kul gupta
kulg123 at gmail.com
Mon Mar 3 04:57:22 CST 2008
To: ace-bugs at cs.wustl.edu
Please Ignore my previous mail ,the code was not complete.
Subject: ACE_RW_Process_Mutex in single writer and multiple readers
ACE VERSION: 5.5.8
HOST MACHINE and OPERATING SYSTEM:
Windows XP Professional and Enterprise Linux 5.0
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" for windows
#include "ace/config-linux.h" for linux
DOES THE PROBLEM AFFECT:
COMPILATION? NO
LINKING? NO
EXECUTION? YES
OTHER
SYNOPSIS:
Use of ACE_RW_Process_Mutex.I developed a very simple program which needs to
be extended for Multiple readers and single writer ( shared memory concept
using a Hash Map with allocator)
Even a single Reader and single writer are not getting
syncronized.Pleaseprovide with a sample program of
ACE_RW_Process_Mutex.
DESCRIPTION:
After having a look into ACE_ROOT/examples/Threads ,I implemented the
following code using ACE_RW_Process_Mutex. and run in both Windows and
linux5.0. But in both the cases the synchronization is not happening .
The Code is written as below
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
ACE_RW_Process_Mutex m_RWMutex(ACE_TEXT("MyMutex"));
if (agrc == 1)
{
while (1)
{
if (m_RWMutex.acquire_write() == 0)
{
ACE_OS::printf("Writer acquired...\n");
ACE_OS::sleep(2);
ACE_OS::printf("Writer releasing...\n");
m_RWMutex.release();
}
}
}
else
{
while (1)
{
if (m_RWMutex.acquire_read() == 0)
{
ACE_OS::printf("Writer acquired...\n");
ACE_OS::sleep(2);
ACE_OS::printf("Writer releasing...\n");
m_RWMutex.release();
}
}
}
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/ace-users/attachments/20080303/0d59d52d/attachment.html
More information about the Ace-users
mailing list