<span class="q"> Hello Doug,
<p style="MARGIN: 0in 0in 0pt"><font face="courier new,monospace"><font size="1"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Subject: </span><span style="FONT-SIZE: 10pt">ACE_RW_Process_Mutex in single writer and multiple readers</span><span style="FONT-SIZE: 9.5pt; FONT-FAMILY: Arial"></span></font></font></p>
<pre><font face="courier new,monospace"><font size="1"><span style="FONT-FAMILY: Arial">ACE VERSION</span>: 5.5.8</font></font></pre>
<div><font face="courier new,monospace"><font size="1"><span style="FONT-FAMILY: Arial">HOST MACHINE and OPERATING SYSTEM</span>:</font></font></div>
<div><font face="courier new,monospace" size="1">Windows XP Professional and Enterprise Linux 5.0</font></div><pre><font face="courier new,monospace" size="1">Version 2002</font></pre><pre><font face="courier new,monospace" size="1">TARGET MACHINE and OPERATING SYSTEM, if different from HOST:NO</font></pre>
<pre><font face="courier new,monospace"><font size="1"><span style="FONT-FAMILY: Arial">COMPILER NAME AND VERSION</span> (AND PATCHLEVEL):</font></font></pre><pre><font face="courier new,monospace" size="1">Visual studio 2005</font></pre>
<p style="MARGIN: 0in 0in 0pt"><font face="courier new,monospace"><font size="1"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">THE $ACE_ROOT/ace/config.h FILE </span><span style="FONT-SIZE: 9.5pt; FONT-FAMILY: Arial"></span></font></font></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">#include "ace/config-win32.h" for windows</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">#include "ace/config-linux.h" for linux</font></font></span></p><pre><font face="courier new,monospace"><font size="1"><span style="FONT-FAMILY: Arial">DOES THE PROBLEM AFFECT</span>:</font></font></pre>
<pre><font face="courier new,monospace" size="1"> COMPILATION? NO</font></pre><pre><font face="courier new,monospace" size="1"> LINKING? NO</font></pre><pre><font face="courier new,monospace" size="1"> EXECUTION? YES</font></pre>
<pre><font face="courier new,monospace" size="1"> OTHER </font></pre><pre><font face="courier new,monospace" size="1"> <span style="FONT-FAMILY: Arial">SYNOPSIS</span>:</font></pre>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">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)</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">Even a single Reader and single writer are not getting syncronized.Please provide with a sample program of ACE_RW_Process_Mutex.</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><font face="courier new,monospace"><font size="1"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> </span><span style="FONT-SIZE: 9.5pt; FONT-FAMILY: Arial"></span></font></font></p><pre>
<font face="courier new,monospace"><font size="1"><span style="FONT-FAMILY: Arial">DESCRIPTION</span>:</font></font></pre></span><span class="q"><pre><font face="courier new,monospace" size="1">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 .</font></pre>
</span>
<div><font face="courier new,monospace" size="1">Yes I have tried with ACE_Process_Mutex.Its working Fine in Windows and linux.I m attaching the code of ACE_Process_Mutex along with its output<span> </span>and also of ACE_RW_Process_Mutex along with its output</font></div>
<div><font face="Courier New" size="1"></font> </div>
<div><font face="Courier New" size="1">The Only change i did in the below code while using is - use of ACE_Process_Mutex in place of ACE_RW_Process_Mutex in the higlighted area.</font></div><pre><font face="courier new,monospace" size="1">The Code is written as below<span> </span>(WITH ACE_RW_Process_Mutex)</font></pre>
<span class="q"><pre><font face="courier new,monospace"><font size="1">int ACE_TMAIN (int argc, ACE_TCHAR *argv[])</font></font></pre>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">{</font></font></span></p></span>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">int count =0;</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">float ltime=0;</font></font></span></p><span class="q">
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> <font style="BACKGROUND-COLOR: #ffff33">ACE_RW_Process_Mutex</font> m_RWMutex(ACE_TEXT("MyMutex"));</font></font></span></p>
</span>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> if (agrc == 1)<span> </span>// For server which is writing</font></font></span></p><span class="q">
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> {</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> while (1)</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> {</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> if (m_RWMutex.acquire_write() == 0)</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> {</font></font></span></p></span>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"><span> </span><span> </span>ltime = ::GetTickCount();</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> ACE_OS::printf("Writer acquired...%d<span> </span>at: %f\n",count++,ltime);</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> ACE_OS::sleep(2);</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"><span> </span><span> </span>ltime = ::GetTickCount();</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> ACE_OS::printf("Writer releasing... ...%d<span> </span>at: %f\n",count++,ltime);</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> m_RWMutex.release();</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> }</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> }</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> }</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> else<span> </span>//For Client which is reading </font></font></span></p><span class="q">
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> {</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> while (1)</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> {</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> if (m_RWMutex.acquire_read() == 0)</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> {</font></font></span></p></span>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> ltime = ::GetTickCount(); </font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"><span> </span><span> </span>ACE_OS::printf("Reader acquired... ...%d<span> </span>at: %f\n",count++,ltime);</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> ACE_OS::sleep(2);</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"><span> </span><span> </span>ltime = ::GetTickCount();</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> ACE_OS::printf("Reader releasing...%d<span> </span>at: %f\n",count++,ltime);</font></font></span></p>
<span class="q">
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> m_RWMutex.release();</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> }</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> }</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> }</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1"> return 0;</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">}</font></font></span></p></span><pre><font face="courier new,monospace" size="1">output is like this(WITH ACE_RW_Process_Mutex):</font></pre>
<pre><font face="courier new,monospace" size="1">Writer </font></pre>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer acquired<span> </span>0 <span> </span>at<span> </span>88110592</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer released<span> </span>0 <span> </span>at<span> </span>88112592</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer acquired<span> </span>1<span> </span><span> </span>at<span> </span>88112592</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer released<span> </span>1<span> </span><span></span>at<span> </span>88114592</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer acquired<span> </span>2<span> </span><span> </span>at<span> </span>88114592</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer released<span> </span>2<span> </span><span> </span>at<span> </span>88116592</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer acquired<span> </span>3 <span> </span>at<span> </span>88116592</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer released <span> </span>3 <span> </span>at<span> </span>88118592</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><font face="courier new,monospace" size="1"> </font></p>
<p style="MARGIN: 0in 0in 0pt"><font face="courier new,monospace" size="1">Reader</font></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">Reader acquired<span> </span>0<span> </span>at<span> </span>88112872</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">Reader released<span> </span>0<span> </span>at<span> </span>88114872</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">Reader acquired<span> </span>1<span> </span>at<span> </span>88114872</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">Reader released<span> </span>1<span> </span>at<span> </span>88116872</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">Reader acquired<span> </span>2<span> </span>at<span> </span>88116872</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">Reader released<span> </span>2<span> </span>at<span> </span>88118872</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">Reader acquired<span> </span>3<span> </span>at<span> </span>88118872</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><font face="courier new,monospace" size="1"> </font></p>
<p style="MARGIN: 0in 0in 0pt"><font face="courier new,monospace" size="1"> </font></p>
<p style="MARGIN: 0in 0in 0pt"><font face="courier new,monospace" size="1">output is like this (WITH ACE_Process_Mutex):</font></p>
<p style="MARGIN: 0in 0in 0pt"><font face="courier new,monospace" size="1">Writer </font></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer acquired<span> </span>0 <span> </span>at<span> </span>88560984</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer released<span> </span>0 <span> </span>at<span> </span>88562984</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer acquired<span> </span>1<span> </span><span> </span>at<span> </span>88562984</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer released<span> </span>1<span> </span><span></span>at<span> </span>88564984</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer acquired<span> </span>2<span> </span><span> </span>at<span> </span>88566984</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer released<span> </span>2<span> </span><span> </span>at <span> </span>88568984</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer acquired<span> </span>3 <span> </span>at<span> </span>88570984</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">writer released<span> </span>3 <span> </span>at<span> </span>88572984</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><font face="courier new,monospace" size="1"> </font></p>
<p style="MARGIN: 0in 0in 0pt"><font face="courier new,monospace" size="1">Reader</font></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">Reader acquired<span> </span>0<span> </span>at<span> </span>88564984</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">Reader released<span> </span>0<span> </span>at<span> </span>88566984</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">Reader acquired<span> </span>1<span> </span>at<span> </span>88568984</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">Reader released<span> </span>1<span> </span>at<span> </span>88570984</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">Reader acquired<span> </span>2<span> </span>at<span> </span>88572984</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">Reader released<span> </span>2<span> </span>at<span> </span>88574984</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace"><font size="1">Reader acquired<span> </span>3<span> </span>at<span> </span>88576984</font></font></span></p>
<p style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt"><font face="courier new,monospace" size="1">Reader released<span> </span>3<span> </span>at<span> </span>88578984</font></span></p>
<div>Thanks</div>
<div>Ruchita<br><br> </div>
<div><span class="gmail_quote">On 3/3/08, <b class="gmail_sendername">Douglas C. Schmidt</b> <<a href="mailto:schmidt@dre.vanderbilt.edu">schmidt@dre.vanderbilt.edu</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi,<br><br> Thanks for using the PRF.<br><br>>ACE VERSION: 5.5.8<br>><br>>HOST MACHINE and OPERATING SYSTEM:<br>
><br>><br>><br>>Windows XP Professional and Enterprise Linux 5.0<br>><br>>Version 2002<br>><br>>TARGET MACHINE and OPERATING SYSTEM, if different from HOST:NO<br>><br>>COMPILER NAME AND VERSION (AND PATCHLEVEL):<br>
><br>>Visual studio 2005<br>><br>>THE $ACE_ROOT/ace/config.h FILE<br>><br>>#include "ace/config-win32.h" for windows<br>><br>>#include "ace/config-linux.h" for linux<br>><br>
>DOES THE PROBLEM AFFECT:<br>><br>> COMPILATION? NO<br>><br>> LINKING? NO<br>><br>> EXECUTION? YES<br>><br>> OTHER<br>><br>> SYNOPSIS:<br>><br>
>Use of ACE_RW_Process_Mutex.I developed a very simple program which needs to<br>>be extended for Multiple readers and single writer ( shared memory concept<br>>using a Hash Map with allocator)<br>><br>>Even a single Reader and single writer are not getting<br>
>syncronized.Pleaseprovide with a sample program of<br>>ACE_RW_Process_Mutex.<br><br>Have you tried running this using ACE_Process_Mutex instead of<br>ACE_RW_Process_Mutex to see what happens?<br><br>Thanks,<br><br>
Doug<br><br>><br>><br>>DESCRIPTION:<br>><br>>After having a look into ACE_ROOT/examples/Threads ,I implemented the<br>>following code using ACE_RW_Process_Mutex. and run in both Windows and<br>>linux5.0. But in both the cases the synchronization is not happening .<br>
><br>><br>><br>>The Code is written as below<br>><br>><br>><br>><br>><br>>int ACE_TMAIN (int argc, ACE_TCHAR *argv[])<br>><br>>{<br>><br>> ACE_RW_Process_Mutex m_RWMutex(ACE_TEXT("MyMutex"));<br>
><br>> if (agrc == 1)<br>><br>> {<br>><br>> while (1)<br>><br>> {<br>><br>> if (m_RWMutex.acquire_write() == 0)<br>><br>> {<br>><br>> ACE_OS::printf("Writer acquired...\n");<br>
><br>> ACE_OS::sleep(2);<br>><br>> ACE_OS::printf("Writer releasing...\n");<br>><br>> m_RWMutex.release();<br>><br>> }<br>><br>> }<br>
><br>> }<br>><br>> else<br>><br>> {<br>><br>> while (1)<br>><br>> {<br>><br>> if (m_RWMutex.acquire_read() == 0)<br>><br>> {<br>><br>
> ACE_OS::printf("Writer acquired...\n");<br>><br>> ACE_OS::sleep(2);<br>><br>> ACE_OS::printf("Writer releasing...\n");<br>><br>> m_RWMutex.release();<br>
><br>> }<br>><br>> }<br>><br>> }<br>><br>> return 0;<br>><br>>}<br>><br>>------=_Part_5765_23997741.1204541871901<br>>Content-Type: text/html; charset=ISO-8859-1<br>
>Content-Transfer-Encoding: 7bit<br>>Content-Disposition: inline<br>><br>><pre><font size="2">To: </font><a href="mailto:<a href="mailto:ace-bugs@cs.wustl.edu">ace-bugs@cs.wustl.edu</a>" target="_blank"><font size="2"><a href="mailto:ace-bugs@cs.wustl.edu">ace-bugs@cs.wustl.edu</a></font></a></pre><br>
><div><font size="2">Please Ignore my previous mail ,the code was not complete.</font></div><br>><div><font size="2">Subject: ACE_RW_Process_Mutex in single writer and multiple readers</font></div><pre><font size="2">ACE VERSION: 5.5.8</font></pre><pre><font size="2">HOST MACHINE and OPERATING SYSTEM:</font></pre><pre><br>
><font size="2">&nbsp;</font></pre><pre><font size="2">Windows XP Professional and Enterprise Linux 5.0</font></pre><pre><font size="2">Version 2002</font></pre><pre><font size="2">TARGET MACHINE and OPERATING SYSTEM, if different from HOST:NO</font></pre><br>
><pre><font size="2">COMPILER NAME AND VERSION (AND PATCHLEVEL):</font></pre><pre><font size="2">Visual studio 2005</font></pre><br>><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">THE $ACE_ROOT/ace/config.h FILE </span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">#include &quot;ace/config-win32.h&quot;<span style="mso-spacerun: yes">&nbsp;&nbsp; </span>for windows</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">#include &quot;ace/config-linux.h&quot;<span style="mso-spacerun: yes">&nbsp;&nbsp; </span>for linux</span></p><pre><br>
><font size="2">DOES THE PROBLEM AFFECT:</font></pre><pre><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMPILATION? &nbsp; NO</font></pre><pre><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LINKING?&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; NO</font></pre><pre><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXECUTION?&nbsp;&nbsp;&nbsp;&nbsp; YES</font></pre><br>
><pre><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OTHER &nbsp;</font></pre><pre><font size="2">&nbsp;&nbsp;&nbsp; SYNOPSIS:</font></pre><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">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)</span></p><br>
><br>><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">Even a single Reader and single writer are not getting syncronized.Please provide with a sample program of ACE_RW_Process_Mutex.</span></p><br>
><br>><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;</span></p><pre><font size="2">DESCRIPTION:</font></pre><pre><font size="2">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 .</font></pre><br>
><pre><font size="2">&nbsp;</font></pre><pre><font size="2">The Code is written as below</font></pre><pre><span style="FONT-FAMILY: Arial"><font size="2">&nbsp;</font></span></pre><pre><font size="2">&nbsp;</font></pre><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">int ACE_TMAIN (int argc, ACE_TCHAR *argv[])</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">{</span></p><br>><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp; ACE_RW_Process_Mutex m_RWMutex(ACE_TEXT(&quot;MyMutex&quot;));</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp; if (agrc == 1)</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp; {</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (1)</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (m_RWMutex.acquire_write() == 0)</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_OS::printf(&quot;Writer acquired...\n&quot;);</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_OS::sleep(2);</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_OS::printf(&quot;Writer releasing...\n&quot;);</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_RWMutex.release();</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp; }</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp; else</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp; {</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (1)</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (m_RWMutex.acquire_read() == 0)</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_OS::printf(&quot;Writer acquired...\n&quot;);</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_OS::sleep(2);</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_OS::printf(&quot;Writer releasing...\n&quot;);</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_RWMutex.release();</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp; }</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">&nbsp;&nbsp;&nbsp; return 0;</span></p><br>
><p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;">}</span></p><pre><br style="mso-special-character: line-break"></pre><br>
><br>>------=_Part_5765_23997741.1204541871901--<br>><br><br><br>--<br>Dr. Douglas C. Schmidt Professor and Associate Chair<br>Electrical Engineering and Computer Science TEL: (615) 343-8197<br>
Vanderbilt University WEB: <a href="http://www.dre.vanderbilt.edu/~schmidt">www.dre.vanderbilt.edu/~schmidt</a><br>Nashville, TN 37203 NET: <a href="mailto:d.schmidt@vanderbilt.edu">d.schmidt@vanderbilt.edu</a><br>
</blockquote></div><br>