<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v = 
"urn:schemas-microsoft-com:vml" xmlns:o = 
"urn:schemas-microsoft-com:office:office" xmlns:w = 
"urn:schemas-microsoft-com:office:word" xmlns:x = 
"urn:schemas-microsoft-com:office:excel" xmlns:p = 
"urn:schemas-microsoft-com:office:powerpoint" xmlns:a = 
"urn:schemas-microsoft-com:office:access" xmlns:dt = 
"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s = 
"uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs = 
"urn:schemas-microsoft-com:rowset" xmlns:z = "#RowsetSchema" xmlns:b = 
"urn:schemas-microsoft-com:office:publisher" xmlns:ss = 
"urn:schemas-microsoft-com:office:spreadsheet" xmlns:c = 
"urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:oa = 
"urn:schemas-microsoft-com:office:activation" xmlns:html = 
"http://www.w3.org/TR/REC-html40" xmlns:q = 
"http://schemas.xmlsoap.org/soap/envelope/" XMLNS:D = "DAV:" xmlns:x2 = 
"http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ois = 
"http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir = 
"http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds = 
"http://www.w3.org/2000/09/xmldsig#" xmlns:dsp = 
"http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc = 
"http://schemas.microsoft.com/data/udc" xmlns:xsd = 
"http://www.w3.org/2001/XMLSchema" xmlns:sps = 
"http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi = 
"http://www.w3.org/2001/XMLSchema-instance" xmlns:udcxf = 
"http://schemas.microsoft.com/data/udc/xmlfile" xmlns:m = 
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3268" name=GENERATOR><!--[if !mso]>
<STYLE>v\:* {
        BEHAVIOR: url(#default#VML)
}
o\:* {
        BEHAVIOR: url(#default#VML)
}
w\:* {
        BEHAVIOR: url(#default#VML)
}
.shape {
        BEHAVIOR: url(#default#VML)
}
</STYLE>
<![endif]-->
<STYLE>@font-face {
        font-family: Courier;
}
@font-face {
        font-family: Courier;
}
@font-face {
        font-family: Calibri;
}
@font-face {
        font-family: Tahoma;
}
@font-face {
        font-family: Consolas;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
P.MsoPlainText {
        FONT-SIZE: 10.5pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: Consolas; mso-style-priority: 99; mso-style-link: "Plain Text Char"
}
LI.MsoPlainText {
        FONT-SIZE: 10.5pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: Consolas; mso-style-priority: 99; mso-style-link: "Plain Text Char"
}
DIV.MsoPlainText {
        FONT-SIZE: 10.5pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: Consolas; mso-style-priority: 99; mso-style-link: "Plain Text Char"
}
PRE {
        FONT-SIZE: 10pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Courier New"; mso-style-priority: 99; mso-style-link: "HTML Preformatted Char"
}
SPAN.HTMLPreformattedChar {
        FONT-FAMILY: "Courier New"; mso-style-priority: 99; mso-style-link: "HTML Preformatted"; mso-style-name: "HTML Preformatted Char"
}
SPAN.PlainTextChar {
        FONT-FAMILY: Consolas; mso-style-priority: 99; mso-style-link: "Plain Text"; mso-style-name: "Plain Text Char"
}
SPAN.EmailStyle21 {
        COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal
}
SPAN.EmailStyle22 {
        COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal
}
SPAN.EmailStyle23 {
        COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal
}
SPAN.EmailStyle24 {
        COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal
}
SPAN.EmailStyle25 {
        COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal
}
SPAN.EmailStyle26 {
        COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal
}
SPAN.EmailStyle27 {
        COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal
}
SPAN.EmailStyle29 {
        COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-reply
}
.MsoChpDefault {
        FONT-SIZE: 10pt; mso-style-type: export-only
}
DIV.Section1 {
        page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff 
size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>Hi,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>Below you can find&nbsp;an extended version of the 
ACE_wrappers/tests/Message_Queue_Notifications_Test.cpp</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>The original source was taken from&nbsp;the head of <A 
href="https://svn.dre.vanderbilt.edu/viewvc/Middleware/"><STRONG><FONT 
face="Times New Roman" size=3> [Middleware]</FONT></STRONG></A><FONT 
face="Times New Roman" color=#000000 size=3><STRONG> / </STRONG></FONT><A 
href="https://svn.dre.vanderbilt.edu/viewvc/Middleware/trunk/"><STRONG><FONT 
face="Times New Roman" size=3>trunk</FONT></STRONG></A><FONT 
face="Times New Roman" color=#000000 size=3><STRONG> / </STRONG></FONT><A 
href="https://svn.dre.vanderbilt.edu/viewvc/Middleware/trunk/ACE/"><STRONG><FONT 
face="Times New Roman" size=3>ACE</FONT></STRONG></A><FONT 
face="Times New Roman" color=#000000 size=3><STRONG> / </STRONG></FONT><A 
href="https://svn.dre.vanderbilt.edu/viewvc/Middleware/trunk/ACE/tests/"><STRONG><FONT 
face="Times New Roman" size=3>tests</FONT></STRONG></A><STRONG><FONT 
face="Times New Roman" color=#000000 size=3> / 
Message_Queue_Notifications_Test.cpp</FONT></STRONG></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>(Subversion web)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>NEW TESTS</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>Two new tests are added which both can be (de)selected 
with defines:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=721330413-11032008>1) </SPAN>TEST_CLOSEHOOK<SPAN 
class=721330413-11032008>: This should test the usecase where notify() race 
conditions can occur when an Task EH uses "delete this" in its close hook. 
</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=721330413-11032008>However,&nbsp;the race condition&nbsp;is 
not&nbsp;reproducable for sure. </SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=721330413-11032008>I have&nbsp;had a segmentation fault only once and 
unfortunately at that time&nbsp;coredump was not active on my test 
system.</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=721330413-11032008>I tried to increase the chance of race condition by 
adding an iteration loop but that didn't help 
either...</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=721330413-11032008>Any ideas for getting the race condition addressed for 
sure might be useful.</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff 
size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>2) TEST_FULLNOTIFY: This tests the deadlock-usecase 
(notified message enqueue with full reactor notification 
pipe).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>On&nbsp;our test scoreboard this test will timeout when 
the deadlock occurs (maximum run time per test allowed)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>The deadlock is always adressed whith the latest 
version of ACE.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008></SPAN></FONT><FONT face=Arial color=#0000ff 
size=2><SPAN class=721330413-11032008></SPAN></FONT><FONT face=Arial 
color=#0000ff size=2><SPAN class=721330413-11032008></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>NOTES:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>If you want to use this, two things have to be looked 
at before checking in:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>1) #includes section: I had to change some includes in 
order to get the test through&nbsp;our compilers and the ACE versions used for 
the different platforms (W32 BCB ACE-5.3.1,&nbsp;RH9&nbsp;gcc 
ACE-5.3.1,&nbsp;FC6&nbsp;gcc ACE-5.5.6)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>2) "ACE_TMAIN (int, ACE_TCHAR *[])" probably to be 
replaced with "run_main (int, ACE_TCHAR *[])" ?<BR>(In subversion it was 
"run_main" but that doesn't work with the ACE versions we use, which are 
probably already very old...).<BR></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>By the way,&nbsp;some minor change&nbsp;has been 
made&nbsp;in&nbsp;the code so the default_message = "ACE RULES" is used for all 
the test cases which enqueue messages...</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>&nbsp;</DIV></SPAN></FONT>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>Message_Queue_T.cpp:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>For now, I've patched this code to avoid deadlocks. In 
our applications we don't use "delete this" on any EH so we won't get struck by 
the race conditions.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008>A suggested fix for both of the <SPAN 
class=721330413-11032008>Message_Queue_T.cpp notify problems (race / deadlock) 
is in my second post in this bug-thread (Feb 27 2008 3:37pm). See also FIX CODE 
EXAMPLE&nbsp;below in this post.&nbsp;However that is only pseudo code, not 
fully worked out. It probably also needs modifications in the 
Notification_Strategy and Reactor classes.</SPAN></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008><SPAN 
class=721330413-11032008></SPAN></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008><SPAN 
class=721330413-11032008>Regards,</SPAN></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008><SPAN 
class=721330413-11032008></SPAN></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008>
<DIV align=left><SPAN class=904435009-11112005><SPAN 
class=904435009-11112005><SPAN class=904435009-11112005><SPAN 
class=904435009-11112005><STRONG><FONT face=Arial><FONT color=#0000ff><FONT 
size=2><SPAN 
class=721330413-11032008>Rudy</SPAN>&nbsp;Pot</FONT></FONT></FONT></STRONG></SPAN></DIV>
<DIV>
<DIV>
<DIV>
<DIV>
<DIV align=left>
<DIV><SPAN class=904435009-11112005><FONT face=Arial color=#0000ff 
size=2>Embedded Computer Systems</FONT></SPAN></DIV>
<DIV><SPAN class=904435009-11112005><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=904435009-11112005><FONT face=Arial color=#0000ff 
size=2><STRONG>AWETA G&amp;P b.v</STRONG></FONT></SPAN></DIV>
<DIV><SPAN class=904435009-11112005>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=203213811-11042007>Postbox 17</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=203213811-11042007>NL-2630 AA&nbsp; 
Nootdorp</SPAN></FONT></DIV></SPAN></DIV>
<DIV><SPAN class=904435009-11112005>
<DIV><SPAN class=904435009-11112005><FONT face=Arial color=#0000ff size=2>tel 
+31 (0)15 3109961 </FONT>
<DIV><SPAN class=904435009-11112005><FONT face=Arial color=#0000ff 
size=2>fax&nbsp;+31 (0)15 310<SPAN class=904435009-11112005>7321</SPAN> </FONT>
<DIV><SPAN class=904435009-11112005><FONT face=Arial color=#0000ff 
size=2>mail&nbsp;</FONT><A href="mailto:rpot@aweta.nl"><FONT face=Arial 
size=2>rpot@aweta.nl</FONT></A></SPAN></DIV>
<DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2>w<SPAN 
class=248343315-01122005>eb <A 
href="blocked::http://www.aweta.com">www.aweta.com</A></SPAN></FONT></FONT></FONT></DIV></SPAN></SPAN></SPAN></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></SPAN></SPAN></SPAN></SPAN><FONT 
face=Arial color=#0000ff size=2><SPAN 
class=721330413-11032008></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff 
size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>// 
============================================================================<BR></FONT></SPAN></FONT></SPAN><SPAN 
class=721330413-11032008><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>// $Id: Message_Queue_Notifications_Test.cpp 10757 
2008-03-10 11:41:40Z rpot $</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>// 
============================================================================<BR>//<BR>// 
= LIBRARY<BR>//&nbsp;&nbsp;&nbsp; tests<BR>//<BR>// = 
FILENAME<BR>//&nbsp;&nbsp;&nbsp; Message_Queue_Notification_Test.cpp<BR>//<BR>// 
= DESCRIPTION<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; There are two tests that test 
2 different notification<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mechanisms in 
Message Queue.<BR>//<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The first test 
illustrates the notification mechanisms in<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Message_Queue and its integration with 
Reactor.<BR>//<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Note the following things 
about this part of the test:<BR>//<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1. 
Multiple threads are not required.<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. You do 
not have to explicitly notify the Reactor<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3. 
This code will work the same with any Reactor 
Implementation<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4. handle_input, 
handle_exception, handle_output are the 
only<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; callbacks supported 
by this mechanism<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5. The notification 
mechanism need not notify the Reactor. You 
can<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write your own 
strategy classes that can do whatever 
application<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; specific 
behavior you want.<BR>//<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The second test 
also makes sure the high/low water mark<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
signaling mechanism works flawlessly.<BR>//<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
The third test handles the use case of notification strategy in 
<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; combination with EH "delete this" 
termination.<BR>//<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; There is also a fourth 
stress test added for addressing possible <BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
notification deadlocks. It look similar as the first test but needs 
<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; threads. If deadlock occurs, this test has 
to be killed to terminate.<BR>//<BR>// = AUTHOR<BR>//&nbsp;&nbsp;&nbsp; Irfan 
Pyarali &lt;<A href="mailto:irfan@cs.wustl.edu">irfan@cs.wustl.edu</A>&gt; and 
Nanbor Wang &lt;<A 
href="mailto:nanbor@cs.wustl.edu">nanbor@cs.wustl.edu</A>&gt;<BR>//<BR>// 
============================================================================<BR>#include 
"test_config.h"<BR>#include "ace/Reactor.h"<BR>#include "ace/Task.h"<BR>#include 
"ace/Reactor_Notification_Strategy.h"<BR>#include 
"ace/Atomic_Op.h"</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>#ifndef ACE_SYNCH_H<BR>#include 
"ace/Synch.h"<BR>#endif<BR>//#include "ace/Barrier.h"<BR>//#include 
"ace/Synch_Traits.h"<BR>//#include "ace/Null_Condition.h"<BR>//#include 
"ace/Null_Mutex.h"</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>// Are below includes needed?<BR>//#include 
"ace/OS_NS_string.h"<BR>//#include "ace/OS_NS_unistd.h"</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>ACE_RCSID(tests, Message_Queue_Notifications_Test, "$Id: 
Message_Queue_Notifications_Test.cpp 10757 2008-03-10 11:41:40Z rpot 
$")</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>static int iterations = 10;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>static const size_t worker_threads = 2;<BR>static const 
char * default_message = "ACE RULES";<BR>static const size_t 
default_high_water_mark = 20;<BR>static const size_t default_low_water_mark = 
10;<BR>static const int watermark_iterations = 2 * 
default_high_water_mark;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>#define TEST_CLOSEHOOK&nbsp; 1&nbsp; // Test for 
Message_Queue_T notify race conditions.<BR>#define TEST_FULLNOTIFY 1&nbsp; // 
Test for Message_Queue_T notify deadlock.</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff 
size=2>//-----------------------------------------------------------------------------<BR>class 
Message_Handler : public ACE_Task&lt;ACE_NULL_SYNCH&gt;<BR>{<BR>&nbsp; // = 
TITLE<BR>&nbsp; //&nbsp;&nbsp; This class implements a notification strategy for 
the Reactor.<BR>public:<BR>&nbsp; // = Initialization and termination.<BR>&nbsp; 
Message_Handler (ACE_Reactor &amp;reactor);<BR>&nbsp; // 
Constructor.</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; // = Demuxing hooks.<BR>&nbsp; virtual int 
handle_input (ACE_HANDLE);<BR>&nbsp; virtual int handle_output (ACE_HANDLE fd = 
ACE_INVALID_HANDLE);<BR>&nbsp; virtual int handle_exception (ACE_HANDLE fd = 
ACE_INVALID_HANDLE);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>private:<BR>&nbsp; int process_message (void);<BR>&nbsp; 
void make_message (void);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; ACE_Reactor_Notification_Strategy 
notification_strategy_;<BR>};</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff 
size=2>//-----------------------------------------------------------------------------<BR>class 
Watermark_Test : public ACE_Task&lt;ACE_SYNCH&gt;<BR>{<BR>&nbsp; // = 
TITLE<BR>&nbsp; //&nbsp;&nbsp;&nbsp;&nbsp; This class test the correct 
functioning of build-in flow<BR>&nbsp; //&nbsp;&nbsp;&nbsp;&nbsp; control 
machanism in ACE_Task.<BR>public:<BR>&nbsp; Watermark_Test 
(void);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; virtual int svc (void);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; int consumer (void);<BR>&nbsp; int producer 
(void);<BR>&nbsp; int put_message (ACE_Time_Value* timeout = 0);<BR>&nbsp; int 
get_message (void);<BR>&nbsp; void print_producer_debug_message 
(void);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>private:<BR>&nbsp; const size_t len_;<BR>&nbsp; const 
size_t hwm_;<BR>&nbsp; const size_t lwm_;<BR>&nbsp; ACE_Atomic_Op 
&lt;ACE_SYNCH_MUTEX, int&gt; role_;<BR>#if defined (ACE_HAS_THREADS)<BR>&nbsp; 
ACE_Barrier mq_full_;<BR>&nbsp; ACE_Barrier mq_low_water_mark_hit_;<BR>#endif /* 
ACE_HAS_THREADS */<BR>};</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff 
size=2>//-----------------------------------------------------------------------------<BR>#if 
defined (ACE_HAS_THREADS)</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>#if defined (TEST_CLOSEHOOK)<BR>class CloseHook_Handler : 
public ACE_Task&lt;ACE_MT_SYNCH&gt;<BR>{<BR>&nbsp; // = TITLE<BR>&nbsp; 
//&nbsp;&nbsp; This class tests the behaviour of the Task &lt;close&gt; hook 
called in <BR>&nbsp; //&nbsp;&nbsp; combination with notified MB_STOP message 
enqueing.<BR>&nbsp; //&nbsp;&nbsp; It should normally cause this dynamically 
created task (EH) to <BR>&nbsp; //&nbsp;&nbsp; gracefully delete 
itself.<BR>public:<BR>&nbsp; // = Initialization and termination.<BR>&nbsp; 
CloseHook_Handler (ACE_Reactor &amp;reactor);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; // = Demuxing hooks.<BR>&nbsp; virtual int 
handle_input (ACE_HANDLE);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; // = Starts the threads needed for 
testing.<BR>&nbsp; virtual int open (void *args = 0); </FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>private:<BR>&nbsp; // = Ensure dynamic creation.<BR>&nbsp; 
virtual ~CloseHook_Handler ();</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; // = Svc hook.<BR>&nbsp; virtual int svc 
(void);<BR>&nbsp; // = Hook called from &lt;ACE_Thread_Exit&gt; during thread 
exit.<BR>&nbsp; virtual int close (u_long flags = 0);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; ACE_Reactor_Notification_Strategy&nbsp;&nbsp; 
notification_strategy_;<BR>&nbsp; 
ACE_Barrier&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
startupBarrier_; <BR>&nbsp; ACE_Message_Block::ACE_Message_Type 
messageType_;<BR>};<BR>#endif /* TEST_CLOSEHOOK */</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff 
size=2>//-----------------------------------------------------------------------------<BR>#if 
defined (TEST_FULLNOTIFY)<BR>class FullNotify_Handler : public 
ACE_Task&lt;ACE_MT_SYNCH&gt;<BR>{<BR>&nbsp; // = TITLE<BR>&nbsp; //&nbsp;&nbsp; 
This class tests the behaviour of (notified) message enqueing at a point 
<BR>&nbsp; //&nbsp;&nbsp; when the Reactor notification pipe is full. It should 
then just block.<BR>&nbsp; //&nbsp;&nbsp; After the (consumer) Reactor eventloop 
has handled some pending <BR>&nbsp; //&nbsp;&nbsp; notifications, the notifiers 
(producer threads) should just get unblocked.<BR>public:<BR>&nbsp; // = 
Initialization and termination.<BR>&nbsp; FullNotify_Handler (ACE_Reactor 
&amp;reactor);<BR>&nbsp; virtual ~FullNotify_Handler ();</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; // = Demuxing hooks.<BR>&nbsp; virtual int 
handle_input (ACE_HANDLE);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; // = Starts the threads needed for 
testing.<BR>&nbsp; virtual int open (void *args = 0); </FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>private:<BR>&nbsp; // = Svc hook.<BR>&nbsp; virtual int svc 
(void);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; void make_message (void);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; ACE_Reactor_Notification_Strategy 
notification_strategy_;<BR>&nbsp; static const 
int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iMAX_NR_THREADS = 
2;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp; // Identifiers needed when we have more than one thread 
active.<BR>&nbsp; 
ACE_thread_t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
thread_ids_[iMAX_NR_THREADS];&nbsp; <BR>};<BR>#endif /* TEST_FULLNOTIFY 
*/</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>#endif /* ACE_HAS_THREADS */</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff 
size=2>//-----------------------------------------------------------------------------<BR>Message_Handler::Message_Handler 
(ACE_Reactor &amp;reactor)<BR>&nbsp; // First time handle_input will be 
called<BR>&nbsp; : notification_strategy_ 
(&amp;reactor,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Event_Handler::READ_MASK)<BR>{<BR>&nbsp; this-&gt;msg_queue 
()-&gt;notification_strategy (&amp;this-&gt;notification_strategy_);<BR>&nbsp; 
this-&gt;make_message ();<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>int<BR>Message_Handler::handle_input 
(ACE_HANDLE)<BR>{<BR>&nbsp; ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("Message_Handler::handle_input\n")));</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; // Next time handle_output will be called.<BR>&nbsp; 
this-&gt;notification_strategy_.mask 
(ACE_Event_Handler::WRITE_MASK);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; return process_message ();<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>int<BR>Message_Handler::handle_output (ACE_HANDLE 
fd)<BR>{<BR>&nbsp; ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("Message_Handler::handle_output\n")));<BR>&nbsp; ACE_UNUSED_ARG 
(fd);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; // Next time handle_exception will be 
called.<BR>&nbsp; this-&gt;notification_strategy_.mask 
(ACE_Event_Handler::EXCEPT_MASK);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; return process_message ();<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>int<BR>Message_Handler::handle_exception (ACE_HANDLE 
fd)<BR>{<BR>&nbsp; ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("Message_Handler::handle_exception\n")));<BR>&nbsp; ACE_UNUSED_ARG 
(fd);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; // Next time handle_input will be called.<BR>&nbsp; 
this-&gt;notification_strategy_.mask 
(ACE_Event_Handler::READ_MASK);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; return this-&gt;process_message 
();<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>int<BR>Message_Handler::process_message 
(void)<BR>{<BR>&nbsp; ACE_Message_Block *mb;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; if (this-&gt;getq 
(mb,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
(ACE_Time_Value *) &amp;ACE_Time_Value::zero) == -1)<BR>&nbsp;&nbsp;&nbsp; 
ACE_ERROR_RETURN 
((LM_ERROR,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT 
("%p\n"),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT 
("dequeue_head")),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
-1);<BR>&nbsp; else<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("message received = 
%s\n"),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
mb-&gt;rd_ptr ()));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mb-&gt;release 
();<BR>&nbsp;&nbsp;&nbsp; }</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; this-&gt;make_message ();<BR>&nbsp; return 
0;<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>void<BR>Message_Handler::make_message (void)<BR>{<BR>&nbsp; 
if (--iterations &gt; 0)<BR>&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_Message_Block 
*mb;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_NEW 
(mb,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Message_Block (default_message));</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("sending message\n")));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;putq (mb);<BR>&nbsp;&nbsp;&nbsp; }<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff 
size=2>//-----------------------------------------------------------------------------<BR>Watermark_Test::Watermark_Test 
(void)<BR>&nbsp; : len_ (ACE_OS::strlen (default_message) + 
1),<BR>&nbsp;&nbsp;&nbsp; hwm_ (this-&gt;len_ * 
default_high_water_mark),<BR>&nbsp;&nbsp;&nbsp; lwm_ (this-&gt;len_ * 
default_low_water_mark),<BR>&nbsp;&nbsp;&nbsp; role_ (0)<BR>#if defined 
(ACE_HAS_THREADS)<BR>&nbsp;&nbsp;&nbsp; , mq_full_ 
(worker_threads),<BR>&nbsp;&nbsp;&nbsp; mq_low_water_mark_hit_ 
(worker_threads)<BR>#endif /* ACE_HAS_THREADS */<BR>{<BR>&nbsp; 
this-&gt;water_marks 
(ACE_IO_Cntl_Msg::SET_LWM,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;lwm_);<BR>&nbsp; this-&gt;water_marks 
(ACE_IO_Cntl_Msg::SET_HWM,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;hwm_);<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>int<BR>Watermark_Test::producer (void)<BR>{<BR>&nbsp; int i 
= watermark_iterations;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; for (ssize_t hwm = 
this-&gt;hwm_;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hwm &gt;= 0 
;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hwm -= 
this-&gt;len_)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;put_message ();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;print_producer_debug_message ();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
i--;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (this-&gt;msg_queue ()-&gt;is_full 
())<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("(%P|%t) Producer: High water mark hit ---- 
\n")));</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; ACE_MT (this-&gt;mq_full_.wait 
());</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; // The following put_message should block until the 
message queue<BR>&nbsp; // has dropped under the lwm.<BR>&nbsp; 
this-&gt;put_message ();</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; ACE_ASSERT (this-&gt;msg_queue ()-&gt; message_bytes 
() &lt;= this-&gt;lwm_ + this-&gt;len_);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; this-&gt;print_producer_debug_message 
();</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; for (i--; i &gt;= 0 ; i--)<BR>&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this-&gt;put_message 
();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this-&gt;print_producer_debug_message 
();<BR>&nbsp;&nbsp;&nbsp; }</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; return 0;<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>int<BR>Watermark_Test::consumer (void)<BR>{<BR>&nbsp; 
ACE_MT (this-&gt;mq_full_.wait ());</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; ACE_OS::sleep (1);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; // Let producer proceed and block in 
putq.</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; for (int i = watermark_iterations; i &gt;= 0; 
i--)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;get_message ();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_OS::sleep 
(0);<BR>&nbsp;&nbsp;&nbsp; }</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; return 0;<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>int<BR>Watermark_Test::get_message (void)<BR>{<BR>&nbsp; 
ACE_Message_Block *mb;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; if (this-&gt;getq (mb) == -1)<BR>&nbsp;&nbsp;&nbsp; 
ACE_ERROR_RETURN 
((LM_ERROR,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT 
("%p\n"),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT 
("dequeue_head")),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
-1);<BR>&nbsp; else<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("(%P|%t) Consumer: message size = %3d, 
")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("message count = 
%3d\n"),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;msg_queue ()-&gt; message_bytes 
(),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;msg_queue ()-&gt; message_count ()));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
mb-&gt;release ();<BR>&nbsp;&nbsp;&nbsp; }</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; return 0;<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>int<BR>Watermark_Test::put_message (ACE_Time_Value 
*timeout)<BR>{<BR>&nbsp; ACE_Message_Block *mb;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; ACE_NEW_RETURN 
(mb,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Message_Block 
(default_message,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;len_),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
-1);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; return this-&gt;putq (mb, 
timeout);<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>void<BR>Watermark_Test::print_producer_debug_message 
(void)<BR>{<BR>&nbsp; ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("(%P|%t) Producer: message size = %3d, 
")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("message count = 
%3d\n"),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;msg_queue ()-&gt; message_bytes 
(),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;msg_queue ()-&gt; message_count ()));<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>int<BR>Watermark_Test::svc (void)<BR>{<BR>&nbsp; // 
this-&gt;role_ is an Atomic_Op object.<BR>&nbsp; int role = 
this-&gt;role_++;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial 
color=#0000ff size=2>&nbsp; switch (role)<BR>&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp; case 0:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;producer ();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
break;<BR>&nbsp;&nbsp;&nbsp; case 1:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;consumer ();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
break;<BR>&nbsp;&nbsp;&nbsp; default:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
break;<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; return 0;<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV><SPAN class=721330413-11032008><FONT face=Arial color=#0000ff 
size=2>
<DIV dir=ltr 
align=left><BR>//-----------------------------------------------------------------------------<BR>#if 
defined (ACE_HAS_THREADS)</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>#if defined (TEST_CLOSEHOOK)</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>CloseHook_Handler::CloseHook_Handler (ACE_Reactor 
&amp;reactor)<BR>&nbsp; : notification_strategy_ 
(&amp;reactor,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Event_Handler::READ_MASK)<BR>&nbsp; , 
startupBarrier_(2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Barrier for 
ourself and the new thread.<BR>&nbsp; , 
messageType_(ACE_Message_Block::MB_NORMAL)<BR>{<BR>&nbsp; 
this-&gt;msg_queue()-&gt;notification_strategy 
(&amp;this-&gt;notification_strategy_);<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>CloseHook_Handler::~CloseHook_Handler()<BR>{<BR>&nbsp; 
if (this-&gt;reactor() != 0)<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; // Remove ourself 
from reactor Eh queue (don't call handle_close).<BR>&nbsp;&nbsp;&nbsp; 
this-&gt;reactor()-&gt;remove_handler(this,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Event_Handler::READ_MASK 
|<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Event_Handler::DONT_CALL&nbsp; );<BR>&nbsp;&nbsp;&nbsp; this-&gt;reactor(0); 
<BR>&nbsp; };<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>int<BR>CloseHook_Handler::handle_input 
(ACE_HANDLE)<BR>{<BR>&nbsp; ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("CloseHook_Handler::handle_input\n")));</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp; // All messages handled in svc().<BR>&nbsp; 
return 0; // Stay registered.<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>int<BR>CloseHook_Handler::open (void 
*args)<BR>{<BR>&nbsp; ACE_UNUSED_ARG (args);<BR>&nbsp; if 
(this-&gt;activate(THR_NEW_LWP | THR_DETACHED) &lt; 0)<BR>&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp; ACE_ERROR_RETURN 
((LM_ERROR<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,ACE_TEXT ("CloseHook_Handler::open, activate 
ERROR(%s)!\n")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,strerror(ACE_OS::last_error())<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
),-1);<BR>&nbsp; };<BR>&nbsp; startupBarrier_.wait();<BR>&nbsp; return 
0;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>int<BR>CloseHook_Handler::svc 
(void)<BR>{<BR>ACE_Message_Block *pMb=0;</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp; startupBarrier_.wait();<BR>&nbsp; while 
(messageType_ != ACE_Message_Block::MB_STOP)<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; 
if (this-&gt;msg_queue()-&gt;dequeue_head(pMb) &gt;= 0) //&nbsp; Block on input 
queue.<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; messageType_ = 
pMb-&gt;msg_type();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
pMb-&gt;release();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_DEBUG ((LM_DEBUG, 
ACE_TEXT ("CloseHook_Handler::svc[t=%t]: 
pMb-&gt;release()\n")));<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; 
else<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_DEBUG 
((LM_WARNING,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("CloseHook_Handler::svc: Invalid message 
dequeued!\n")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
));<BR>&nbsp;&nbsp;&nbsp; };<BR>&nbsp; };<BR>&nbsp; return 0;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>int <BR>CloseHook_Handler::close (u_long 
flags)<BR>{<BR>&nbsp; ACE_UNUSED_ARG (flags);<BR>&nbsp; ACE_DEBUG 
((LM_DEBUG,ACE_TEXT ("CloseHook_Handler::close hook called.\n")));<BR>&nbsp; // 
Service thread has exited, and this object is now invalid.<BR>&nbsp; delete 
this;<BR>&nbsp; return 0;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>#endif /* TEST_CLOSEHOOK */</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr 
align=left>//-----------------------------------------------------------------------------<BR>#if 
defined (TEST_FULLNOTIFY)</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>FullNotify_Handler::FullNotify_Handler (ACE_Reactor 
&amp;reactor)<BR>&nbsp; : notification_strategy_ 
(&amp;reactor,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Event_Handler::READ_MASK)<BR>{<BR>&nbsp; 
this-&gt;reactor(&amp;reactor);<BR>&nbsp; 
this-&gt;msg_queue()-&gt;notification_strategy 
(&amp;this-&gt;notification_strategy_);<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>FullNotify_Handler::~FullNotify_Handler()<BR>{<BR>&nbsp; 
this-&gt;wait();<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>int<BR>FullNotify_Handler::handle_input 
(ACE_HANDLE)<BR>{<BR>&nbsp; ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("FullNotify_Handler::handle_input\n")));</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp; ACE_Message_Block *mb;</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp; if 
(this-&gt;msg_queue()-&gt;is_empty())<BR>&nbsp;&nbsp;&nbsp; ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("Message queue is 
empty!\n")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
));<BR>&nbsp; else if (this-&gt;getq 
(mb,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
(ACE_Time_Value *) &amp;ACE_Time_Value::zero) == -1)<BR>&nbsp;&nbsp;&nbsp; 
ACE_ERROR_RETURN 
((LM_ERROR,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT 
("%p\n"),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT 
("dequeue_head")),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
-1);<BR>&nbsp; else<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("message received = 
%s\n"),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
mb-&gt;rd_ptr ()));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mb-&gt;release 
();<BR>&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp; return 0; // Stay registered.<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>int<BR>FullNotify_Handler::open (void 
*args)<BR>{<BR>&nbsp; ACE_UNUSED_ARG (args);<BR>&nbsp; // Activate the threads: 
Most are default parms, except n_threads <BR>&nbsp; // and 
thread_ids_.<BR>&nbsp; // thread_ids_ is used to distinguise between the 
threads.<BR>&nbsp; if 
(this-&gt;activate(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// Activate the svc() 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
THR_NEW_LWP | THR_JOINABLE&nbsp;&nbsp; // (default) 
flags.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,iMAX_NR_THREADS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// - n_threads 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// (default) 
force_active<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,ACE_DEFAULT_THREAD_PRIORITY&nbsp; // (default) 
priority<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,-1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// (default) 
grp_id<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// (default) 
*task<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// (default) 
thread_handles[]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// (default) 
*stack[]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// (default) 
stack_size[]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,thread_ids_&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// - thread_ids[]&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
) &lt; 0)<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; ACE_ERROR_RETURN 
((LM_ERROR<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,ACE_TEXT ("FullNotify_Handler::open, activate 
ERROR(%s)!\n")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,strerror(ACE_OS::last_error())<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
),-1);<BR>&nbsp; };<BR>&nbsp; return 0;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>int<BR>FullNotify_Handler::svc (void)<BR>{<BR>int 
iNotifications=0;</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp; //ACE_DEBUG((LM_ERROR, "&gt;&gt; 
FullNotify_Handler::svc(%t)\n"));<BR>&nbsp; 
//--------------------------------------------<BR>&nbsp; if (ACE_Thread::self() 
== thread_ids_[0]) <BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; // [Thread 
0]<BR>&nbsp;&nbsp;&nbsp; // Hit the reactor's notification queue until it is 
full.<BR>&nbsp;&nbsp;&nbsp; // We can only continue if main thread handles the 
reactor notifications.<BR>&nbsp;&nbsp;&nbsp; // Global 'iterations' will 
countdown if next thread performs 'make_message'.<BR>&nbsp;&nbsp;&nbsp; while 
(iterations &gt; 0)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("(%t) Reactor notification 
(%d)\n")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,iNotifications++<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
));</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Notify the Reactor, 
which will call our &lt;handle_input&gt;.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 
Timeout when notify pipe is full? Somehow it isn't full when 
timeout<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 
occurs.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp; FC6: 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp; - With timeout 
parm:&nbsp;&nbsp;&nbsp; 108 x notify until timeout 
occurs.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp; - Without timeout parm: 432 x 
notify until it blocks.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //ACE_Time_Value 
timeout (10);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //this-reactor()-&gt;notify 
(this, ACE_Event_Handler::READ_MASK, &amp;timeout);</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;reactor()-&gt;notify (this, 
ACE_Event_Handler::READ_MASK);<BR>&nbsp;&nbsp;&nbsp; };<BR>&nbsp; }<BR>&nbsp; 
//--------------------------------------------<BR>&nbsp; else if 
(ACE_Thread::self() == thread_ids_[1])<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; // 
[Thread 1]<BR>&nbsp;&nbsp;&nbsp; // Use Message_Queue and hit the notification 
queue again (blocks).<BR>&nbsp;&nbsp;&nbsp; // We can only continue if main 
thread handles the reactor notifications.</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp; // Sleep some time until notification 
pipe is full?<BR>&nbsp;&nbsp;&nbsp; ACE_OS::sleep(2); <BR>&nbsp;&nbsp;&nbsp; 
while (iterations &gt; 0)<BR>&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;make_message();<BR>&nbsp;&nbsp;&nbsp; };<BR>&nbsp; };</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp; //ACE_DEBUG((LM_ERROR, "&lt;&lt; 
FullNotify_Handler::svc(%t)\n"));<BR>&nbsp; return 0;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>void<BR>FullNotify_Handler::make_message 
(void)<BR>{<BR>&nbsp; if (--iterations &gt; 0)<BR>&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_Message_Block 
*mb;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_NEW 
(mb,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Message_Block (default_message));</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("sending message\n")));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;putq (mb);<BR>&nbsp;&nbsp;&nbsp; }<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>#endif /* TEST_FULLNOTIFY */<BR>#endif /* 
ACE_HAS_THREADS */</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr 
align=left>//-----------------------------------------------------------------------------<BR>int<BR>//run_main 
(int, ACE_TCHAR *[])<BR>ACE_TMAIN (int, ACE_TCHAR *[])<BR>{<BR>&nbsp; 
ACE_START_TEST (ACE_TEXT ("Message_Queue_Notifications_Test"));</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("\nStarting message queue reactive notification 
test...\n")));<BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp; ACE_Reactor 
reactor;<BR>&nbsp;&nbsp;&nbsp; Message_Handler mh (reactor);<BR>&nbsp; 
<BR>&nbsp;&nbsp;&nbsp; while (iterations &gt; 
0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reactor.handle_events ();<BR>&nbsp; 
}<BR>#if defined (ACE_HAS_THREADS)<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("\nStarting message queue watermark 
test...\n")));<BR>&nbsp;&nbsp;&nbsp; Watermark_Test 
watermark_test;<BR>&nbsp;&nbsp;&nbsp; ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("High water mark is 
%d\n")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("Low water mark is 
%d\n"),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
default_high_water_mark,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
default_low_water_mark));<BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp; 
watermark_test.activate (THR_NEW_LWP | 
THR_DETACHED,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
worker_threads);</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp; // This frees the memory used by the 
DETACHED thread.<BR>&nbsp;&nbsp;&nbsp; ACE_Thread_Manager::instance ()-&gt;wait 
();<BR>&nbsp; }<BR>#else<BR>&nbsp; ACE_DEBUG 
((LM_INFO,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("Message queue watermark test not performed because threads are not 
supported\n")));<BR>#endif /* ACE_HAS_THREADS */</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>#if !defined (TEST_CLOSEHOOK)<BR>&nbsp; ACE_DEBUG 
((LM_INFO,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("Task &lt;close&gt; hook trigger test not used.\n")));<BR>#elif 
defined (ACE_HAS_THREADS)<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("\nStarting test: Task &lt;close&gt; hook triggered by notified 
message enqueue...\n")));</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp; 
ACE_Reactor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
reactor;<BR>&nbsp;&nbsp;&nbsp; CloseHook_Handler* pChh&nbsp; = 
0;<BR>&nbsp;&nbsp;&nbsp; ACE_Message_Block* pMBlk = 0;</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp; for (int iIterations=0; 
iIterations&lt;10; iIterations++)<BR>&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Dynamically allocate Task EH which 
deletes itself after MB_STOP <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // is 
received.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_NEW_RETURN (pChh, 
CloseHook_Handler(reactor), -1);<BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 
Start svc thread.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pChh-&gt;open();</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Just enqueue some 
normal messages.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_NEW_RETURN( pMBlk, 
ACE_Message_Block(0, ACE_Message_Block::MB_NORMAL), 
-1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pChh-&gt;putq( pMBlk 
);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_NEW_RETURN( pMBlk, ACE_Message_Block(0, 
ACE_Message_Block::MB_NORMAL), -1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
pChh-&gt;putq( pMBlk );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_NEW_RETURN( pMBlk, 
ACE_Message_Block(0, ACE_Message_Block::MB_NORMAL), 
-1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pChh-&gt;putq( pMBlk );</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Quit svc thread and 
let task delete itself (and see what happens).<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_NEW_RETURN( pMBlk, ACE_Message_Block(0, ACE_Message_Block::MB_STOP), 
-1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pChh-&gt;putq( pMBlk );</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // This frees the memory 
used by the DETACHED thread.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Thread_Manager::instance ()-&gt;wait ();<BR>&nbsp;&nbsp;&nbsp; };</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp; }<BR>#else<BR>&nbsp; ACE_DEBUG 
((LM_INFO,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("Task &lt;close&gt; hook trigger test not performed because threads 
are not supported\n")));<BR>#endif /* ACE_HAS_THREADS */</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>#if !defined (TEST_FULLNOTIFY)<BR>&nbsp; ACE_DEBUG 
((LM_INFO,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("Blocking (full) notification test not used.\n")));<BR>#elif defined 
(ACE_HAS_THREADS)<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; ACE_DEBUG 
((LM_DEBUG,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("\nStarting test: message enqueue with blocking (full) 
notification...\n")));</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp; // Global message enqueue 
iterations.<BR>&nbsp;&nbsp;&nbsp; iterations = 10;&nbsp; </DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp; ACE_Reactor 
reactor;<BR>&nbsp;&nbsp;&nbsp; FullNotify_Handler fnh (reactor); </DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp; // Start producer 
threads.<BR>&nbsp;&nbsp;&nbsp; fnh.open();</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp; // Sleep until notification pipe is 
full and all producer threads block.<BR>&nbsp;&nbsp;&nbsp; ACE_OS::sleep(4); 
</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp; // Empty the notification pipe so 
producers should normally unblock.<BR>&nbsp;&nbsp;&nbsp; while (iterations &gt; 
0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reactor.handle_events ();<BR>&nbsp; 
}<BR>#else<BR>&nbsp; ACE_DEBUG 
((LM_INFO,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_TEXT ("Message enqueue with full notification test not performed because 
threads are not supported\n")));<BR>#endif /* ACE_HAS_THREADS */</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp; ACE_END_TEST;<BR>&nbsp; return 
0;<BR>}<BR></FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Greg Popovitch [mailto:gpy@altair.com] 
<BR><B>Sent:</B> woensdag 27 februari 2008 21:35<BR><B>To:</B> Johnny Willemsen; 
Rudy Pot; ace-bugs@cs.wustl.edu<BR><B>Subject:</B> RE: [ace-bugs] 
[ACE_Message_Queue] notify PIPE block causesSelect_Reactor 
deadlock.<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Johnny, 
I understand completely. I hope someone will provide the regression test (I 
can&#8217;t). Thanks for the help.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">greg<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<DIV>
<DIV 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">From:</SPAN></B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"> Johnny Willemsen 
[mailto:jwillemsen@remedy.nl] <BR><B>Sent:</B> Wednesday, February 27, 2008 3:32 
PM<BR><B>To:</B> Greg Popovitch; 'Rudy Pot'; 
ace-bugs@cs.wustl.edu<BR><B>Subject:</B> RE: [ace-bugs] [ACE_Message_Queue] 
notify PIPE block causesSelect_Reactor 
deadlock.<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p>&nbsp;</o:p></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Hi,<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Even 
when a deadlock can be shown on paper, we do need to have a regression test that 
triggers it. That way we can see it ourselves as core developers and we can also 
make sure we don't introduce the problem back in the future by any other 
change.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Johnny<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<DIV 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: blue 1.5pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: medium none">
<DIV>
<DIV 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">From:</SPAN></B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"> Greg Popovitch 
[mailto:gpy@altair.com] <BR><B>Sent:</B> Wednesday, February 27, 2008 8:14 
PM<BR><B>To:</B> Johnny Willemsen; Rudy Pot; 
ace-bugs@cs.wustl.edu<BR><B>Subject:</B> RE: [ace-bugs] [ACE_Message_Queue] 
notify PIPE block causesSelect_Reactor 
deadlock.<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p>&nbsp;</o:p></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Johnny, 
I agree with the usefulness of having regression tests. <o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Still, 
this issue is a clear deadlock situation, which can be easily explained and 
understood (see below). I think it is a&nbsp; no-brainer to remove a known 
deadlock, occuring when the program is running and busy, even if there is a 
chance of a race condition at exit. &nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Deadlock 
explaination:<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText>In my enqueuing thread:<o:p></o:p></P>
<P class=MsoPlainText>----------------------<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>1/ enqueue a message for the other thread on my own 
message queue<o:p></o:p></P>
<P 
class=MsoPlainText>------------------------------------------------------------------<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (_msg_queue) 
_msg_queue-&gt;enqueue_head(mb);<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>2/ in ACE DLL, enqueue and notify reactor<o:p></o:p></P>
<P class=MsoPlainText>-----------------------------------------<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>template &lt;ACE_SYNCH_DECL&gt; int<o:p></o:p></P>
<P class=MsoPlainText>ACE_Message_Queue&lt;ACE_SYNCH_USE&gt;::enqueue_head 
(ACE_Message_Block *new_item,<o:p></o:p></P>
<P 
class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Time_Value *timeout) {<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; ACE_TRACE 
("ACE_Message_Queue&lt;ACE_SYNCH_USE&gt;::enqueue_head");<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; int queue_count = 0;<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; {<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, 
ace_mon, this-&gt;lock_, -1);<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; if (this-&gt;state_ == 
ACE_Message_Queue_Base::DEACTIVATED)<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; errno = 
ESHUTDOWN;<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
-1;<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; if (this-&gt;wait_not_full_cond 
(ace_mon, timeout) == -1)<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; queue_count = this-&gt;enqueue_head_i 
(new_item);<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; if (queue_count == -1)<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>=&gt;&nbsp;&nbsp;&nbsp; this-&gt;notify ();<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; }<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; return queue_count;<o:p></o:p></P>
<P class=MsoPlainText>}<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>3/ notification proceeds through, nothing interesting 
there<o:p></o:p></P>
<P 
class=MsoPlainText>-----------------------------------------------------------<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACEd.dll!ACE_Reactor_Notification_Strategy::notify()&nbsp; Line 
29<o:p></o:p></P>
<P class=MsoPlainText>C++<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACEd.dll!ACE_Reactor::notify(ACE_Event_Handler * 
event_handler=0x000000002971bc70, unsigned long mask=1, ACE_Time_Value * 
tv=0x00<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACEd.dll!ACE_WFMO_Reactor::notify(ACE_Event_Handler * 
event_handler=0x000000002971bc70, unsigned long mask=1, ACE_Time_Value * 
timeo<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>4/ getting into WFMO reactor which enqueues on its own 
message queue<o:p></o:p></P>
<P 
class=MsoPlainText>--------------------------------------------------------------------<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>int<o:p></o:p></P>
<P class=MsoPlainText>ACE_WFMO_Reactor_Notify::notify (ACE_Event_Handler 
*event_handler,<o:p></o:p></P>
<P 
class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Reactor_Mask mask,<o:p></o:p></P>
<P 
class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Time_Value *timeout) {<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; if (event_handler != 0)<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; {<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_Message_Block *mb = 
0;<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_NEW_RETURN 
(mb,<o:p></o:p></P>
<P 
class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Message_Block (sizeof (ACE_Notification_Buffer)),<o:p></o:p></P>
<P 
class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
-1);<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_Notification_Buffer 
*buffer =<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
(ACE_Notification_Buffer *) mb-&gt;base ();<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buffer-&gt;eh_ = 
event_handler;<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buffer-&gt;mask_ = 
mask;<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Convert from relative 
time to absolute time by adding the<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // current time of 
day.&nbsp; This is what &lt;ACE_Message_Queue&gt;<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // expects.<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (timeout != 
0)<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *timeout += 
timer_queue_-&gt;gettimeofday ();<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>=&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 
(this-&gt;message_queue_.enqueue_tail<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
(mb, timeout) == -1)<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
mb-&gt;release ();<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
return -1;<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
event_handler-&gt;add_reference ();<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; }<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp; return this-&gt;wakeup_one_thread_.signal (); 
}<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>5/ enqueue blocks because queue is full (deadlock because 
calling thread is hung in step 1 and will never dequeue)<o:p></o:p></P>
<P class=MsoPlainText>---------------------------------------<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
message_queue_&nbsp;&nbsp;&nbsp; {head_=0x000000006deaf1d0<o:p></o:p></P>
<P class=MsoPlainText>tail_=0x000000007a5826b0 low_water_mark_=16384 
...}<o:p></o:p></P>
<P class=MsoPlainText>ACE_Message_Queue&lt;ACE_MT_SYNCH&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Message_Queue_Base<o:p></o:p></P>
<P class=MsoPlainText>{state_=1 } ACE_Message_Queue_Base<o:p></o:p></P>
<P 
class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
head_ 0x000000006deaf1d0 {rd_ptr_=0 wr_ptr_=0<o:p></o:p></P>
<P class=MsoPlainText>priority_=0 ...}&nbsp; ACE_Message_Block *<o:p></o:p></P>
<P 
class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
tail_ 0x000000007a5826b0 {rd_ptr_=0 wr_ptr_=0<o:p></o:p></P>
<P class=MsoPlainText>priority_=0 ...}&nbsp; ACE_Message_Block *<o:p></o:p></P>
<P 
class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
low_water_mark_&nbsp;&nbsp; 16384 unsigned __int64<o:p></o:p></P>
<P 
class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
high_water_mark_&nbsp; 16384 unsigned __int64<o:p></o:p></P>
<P 
class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
cur_bytes_&nbsp; 16384 unsigned __int64<o:p></o:p></P>
<P 
class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
cur_length_ 0&nbsp;&nbsp;&nbsp;&nbsp; unsigned __int64<o:p></o:p></P>
<P 
class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
cur_count_&nbsp; 1024&nbsp; unsigned __int64<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>template &lt;ACE_SYNCH_DECL&gt; int<o:p></o:p></P>
<P class=MsoPlainText>ACE_Message_Queue&lt;ACE_SYNCH_USE&gt;::enqueue_tail 
(ACE_Message_Block *new_item,<o:p></o:p></P>
<P 
class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Time_Value *timeout) {<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; ACE_TRACE 
("ACE_Message_Queue&lt;ACE_SYNCH_USE&gt;::enqueue_tail");<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; int queue_count = 0;<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; {<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, 
ace_mon, this-&gt;lock_, -1);<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; if (this-&gt;state_ == 
ACE_Message_Queue_Base::DEACTIVATED)<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; errno = 
ESHUTDOWN;<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
-1;<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>=&gt;&nbsp;&nbsp;&nbsp; if (this-&gt;wait_not_full_cond 
(ace_mon, timeout) == -1)<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; queue_count = this-&gt;enqueue_tail_i 
(new_item);<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; if (queue_count == -1)<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; this-&gt;notify ();<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; }<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; return queue_count;<o:p></o:p></P>
<P class=MsoPlainText>}<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>greg<o:p></o:p></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<DIV>
<DIV 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">From:</SPAN></B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"> Johnny Willemsen 
[mailto:jwillemsen@remedy.nl] <BR><B>Sent:</B> Wednesday, February 27, 2008 1:22 
PM<BR><B>To:</B> Greg Popovitch; 'Rudy Pot'; 
ace-bugs@cs.wustl.edu<BR><B>Subject:</B> RE: [ace-bugs] [ACE_Message_Queue] 
notify PIPE block causesSelect_Reactor 
deadlock.<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p>&nbsp;</o:p></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Hi,<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Also, 
in order to make such an important change to the core of ACE, we do need an 
automated regression test that reproduces the problem. This must be written like 
the ACE regression tests under ACE_wrappers/tests. If someone can make this test 
and add it to bugzilla, the issue gets higher in the todo list, without such a 
test we have to write one, which consumes more time.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Johnny<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<DIV 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: blue 1.5pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: medium none">
<DIV>
<DIV 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">From:</SPAN></B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"> Greg Popovitch 
[mailto:gpy@altair.com] <BR><B>Sent:</B> Wednesday, February 27, 2008 5:37 
PM<BR><B>To:</B> Johnny Willemsen; Rudy Pot; 
ace-bugs@cs.wustl.edu<BR><B>Subject:</B> RE: [ace-bugs] [ACE_Message_Queue] 
notify PIPE block causesSelect_Reactor 
deadlock.<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p>&nbsp;</o:p></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Johnny, 
I didn&#8217;t mean any offense. You do confirm my observation with the statement: 
&#8220;people don't have time anymore to just fix these kind of issues without 
funding&#8221;. I am sorry that this is the case, as I really like ACE. &nbsp;But I 
strongly feel that &nbsp;if there is not anyone who feels enough sense of 
ownership to fix clear bugs like this one, then it is hard to justify using ACE 
in any project which doesn&#8217;t allocate specific funding for ACE 
maintenance.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Now 
again that&#8217;s fine with me, and I certainly don&#8217;t ask anyone to provide a service 
for free. However in the light of my own experience (serious bug fixed in 2002, 
reintroduced in 2003 and still there in 2008), I tend to disagree with the 
statement in ACE&#8217;s overview: &#8220;</SPAN>ACE continues to improve and its <A 
href="http://www.cs.wustl.edu/%7Eschmidt/ACE-future.html">future</A> is 
bright&#8221;.<SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">greg<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<DIV>
<DIV 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">From:</SPAN></B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"> Johnny Willemsen 
[mailto:jwillemsen@remedy.nl] <BR><B>Sent:</B> Wednesday, February 27, 2008 
11:20 AM<BR><B>To:</B> Greg Popovitch; 'Rudy Pot'; 
ace-bugs@cs.wustl.edu<BR><B>Subject:</B> RE: [ace-bugs] [ACE_Message_Queue] 
notify PIPE block causesSelect_Reactor 
deadlock.<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p>&nbsp;</o:p></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Hi,<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Please 
read docs/ACE-bug-process.html, the issue is more that people don't have time 
anymore to just fix these kind of issues without funding. This is a change in 
the core of ACE which has to be investigated, reviewed, tested, all taking time. 
At the moment someone is willing to fund such a change there are multiple people 
that would be willing to work on this. We as Remedy IT do fix issues on the 
doc_group release without funding, but our budgets for doing that are limited, 
at the end we also have to pay our bills.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Johnny<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<DIV 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: blue 1.5pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: medium none">
<DIV>
<DIV 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">From:</SPAN></B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"> Greg Popovitch 
[mailto:gpy@altair.com] <BR><B>Sent:</B> Wednesday, February 27, 2008 5:13 
PM<BR><B>To:</B> Rudy Pot; Johnny Willemsen; 
ace-bugs@cs.wustl.edu<BR><B>Subject:</B> RE: [ace-bugs] [ACE_Message_Queue] 
notify PIPE block causesSelect_Reactor 
deadlock.<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p>&nbsp;</o:p></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Rudy, 
I reported the exact same issue and diagnostic a couple of months ago (see 
mailing list on 11/29/2007 and 11/30/2007). Even though this is a clear bug, it 
seemed to me that there was no one in particular planning to fix the code. I 
ended up patching my own version, moving the notify() in the code below one line 
down after the closing brace, so it would be out of the scope of the ACE_GUARD. 
This fixes the issue and &nbsp;I have not seen any termination race 
conditions.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoPlainText>template &lt;ACE_SYNCH_DECL&gt; int<o:p></o:p></P>
<P class=MsoPlainText>ACE_Message_Queue&lt;ACE_SYNCH_USE&gt;::enqueue_head 
(ACE_Message_Block *new_item,<o:p></o:p></P>
<P 
class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Time_Value *timeout) {<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; ACE_TRACE 
("ACE_Message_Queue&lt;ACE_SYNCH_USE&gt;::enqueue_head");<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; int queue_count = 0;<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; {<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, 
ace_mon, this-&gt;lock_, -1);<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; if (this-&gt;state_ == 
ACE_Message_Queue_Base::DEACTIVATED)<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; errno = 
ESHUTDOWN;<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
-1;<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; if (this-&gt;wait_not_full_cond 
(ace_mon, timeout) == -1)<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;return -1;<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; queue_count = this-&gt;enqueue_head_i 
(new_item);<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp; if (queue_count == -1)<o:p></o:p></P>
<P class=MsoPlainText>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;<o:p></o:p></P>
<P class=MsoPlainText><o:p>&nbsp;</o:p></P>
<P class=MsoPlainText>=&gt;&nbsp;&nbsp;&nbsp; this-&gt;notify ();<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; }<o:p></o:p></P>
<P class=MsoPlainText>&nbsp; return queue_count;<o:p></o:p></P>
<P class=MsoPlainText>}<o:p></o:p></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<DIV>
<DIV 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">From:</SPAN></B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"> 
ace-bugs-bounces@cse.wustl.edu [mailto:ace-bugs-bounces@cse.wustl.edu] <B>On 
Behalf Of </B>Rudy Pot<BR><B>Sent:</B> Wednesday, February 27, 2008 10:30 
AM<BR><B>To:</B> Johnny Willemsen; ace-bugs@cs.wustl.edu<BR><B>Subject:</B> Re: 
[ace-bugs] [ACE_Message_Queue] notify PIPE block causesSelect_Reactor 
deadlock.<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p>&nbsp;</o:p></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">Hi 
Johnny,</SPAN><o:p></o:p></P>
<P class=MsoNormal>&nbsp;<o:p></o:p></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">Thanks 
for your quick response!</SPAN><o:p></o:p></P>
<P class=MsoNormal>&nbsp;<o:p></o:p></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">I have 
had a closer look at all related bug messages and now I see that my <BR>problem 
is already quite old (sorry for that).</SPAN><o:p></o:p></P>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">Correct 
me if I'm wrong but as far as I can see now there are two problems <BR>with 
ace/Message_Queue_T.cpp:</SPAN><o:p></o:p></P>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">1) Sun 
May&nbsp; 5 19:14:34 2002&nbsp; Douglas C. Schmidt&nbsp; &lt;<A 
href="mailto:schm...@macarena.cs.wustl.edu">schm...@macarena.cs.wustl.edu</A>&gt;</SPAN><o:p></o:p></P>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
* ace/Message_Queue_T.cpp: Modified all the enqueue*() methods so 
that<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; their calls to 
notify() occur *outside* of the monitor 
lock.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This change 
prevents deadlock from occurring when a 
reactor's<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; notification 
pipe is full.&nbsp; Thanks to Sasha 
Agranov<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<A 
href="mailto:sagra...@COMGATES.co.il">sagra...@COMGATES.co.il</A>&gt; for 
reporting this.</SPAN><o:p></o:p></P>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">2) Sat 
Mar 22 11:58:12 2003&nbsp; Douglas C. Schmidt&nbsp; &lt;<A 
href="mailto:schm...@tango.doc.wustl.edu">schm...@tango.doc.wustl.edu</A>&gt;</SPAN><o:p></o:p></P>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
* ace/Message_Queue_T.cpp: Moved the notify() hook calls 
within<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the protection 
of the guard lock critical section to 
prevent<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; race 
conditions on cleanup.&nbsp; Thanks to Ron Muck &lt;<A 
href="mailto:r...@sdiusa.com">r...@sdiusa.com</A>&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
for this suggestion. </SPAN><o:p></o:p></P>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">Currently, 
the latter (2) is solved but because of that (1), which is my <BR>problem, has 
returned.</SPAN><o:p></o:p></P>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">Is it 
not possible to solve both problems with adding an extra notify lock? 
</SPAN><o:p></o:p></P>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><BR></SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Courier">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;MessageQueue1, 
lock1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
handle_*<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
[Producer-1]-enqueue--&gt;[|||||||||||||||||||||||||]---&gt;[EH-1] 
&lt;-----+<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
\<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
\ &lt;notifyLock&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;PIPE?&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
+-notify-----&gt;[|||||||||||||||||||||]---&gt;[Reactor]---+<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
(consumer)&nbsp;&nbsp; 
|<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
/<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;MessageQueue-n, 
lock-n&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
/<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
[Producer-n]-enqueue--&gt;[|||||||||||||||||||||||||]---&gt;[EH-n] &lt;----+ 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
handle_*</SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><BR></SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">I will 
point out my idea about this in the following fix code example.</SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">This fix 
might be a problem because I think it needs some interface change in 
<BR>ACE_Notification_Strategy too (to get a notification lock somehow) but you 
have<BR>more insight in the concequences of that. </SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">Maybe 
you first could have a look at this proposal?</SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">Thanks 
in advance,<BR>Rudy Pot</SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">//==============================================================================<BR>FIX 
CODE EXAMPLE&nbsp; (changes applicable for: enqueue_prio, enqueue_head, 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
enqueue_deadline, enqueue_tail )</SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><BR></SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">template 
&lt;ACE_SYNCH_DECL&gt; 
int<BR>ACE_Message_Queue&lt;ACE_SYNCH_USE&gt;::enqueue_prio (ACE_Message_Block 
*new_item,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Time_Value *timeout)<BR>{<BR>&nbsp; ACE_TRACE 
("ACE_Message_Queue&lt;ACE_SYNCH_USE&gt;::enqueue_prio");<BR>&nbsp; int 
queue_count = 0;<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; ACE_GUARD_RETURN 
(ACE_SYNCH_MUTEX_T, ace_mon, this-&gt;lock_, -1);</SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
if (this-&gt;state_ == 
ACE_Message_Queue_Base::DEACTIVATED)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; errno = 
ESHUTDOWN;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
-1;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
if (this-&gt;wait_not_full_cond (ace_mon, timeout) == 
-1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;</SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">+&nbsp;&nbsp; 
{<BR>+&nbsp;&nbsp;&nbsp;&nbsp; ACE_GUARD_RETURN 
(ACE_SYNCH_MUTEX_T<BR>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,ace_notify_mon<BR>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// Would be handy if 
ACE_Notification_Strategy<BR>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// has a lock. To be gathered from notify 
target<BR>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// 
(reactor?)<BR>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// Problem: ACE_Reactor_Notification_Strategy has stored&nbsp; 
<BR>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// Reactor reference but ACE_Notification_Strategy 
not.<BR>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
,this-&gt;notification_strategy-&gt;lock()<BR>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
, -1);</SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">+&nbsp;&nbsp;&nbsp;&nbsp; 
// Somehow check if the (reactor?) notification channel is 
full.<BR>+&nbsp;&nbsp;&nbsp;&nbsp; // Probably needs 
this-&gt;notification_strategy too.<BR>+&nbsp;&nbsp;&nbsp;&nbsp; if 
(this-&gt;wait_no_notify_full_cond (ace_notify_mon, timeout) == 
-1)<BR>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1; // We cannot enqueue 
without causing a deadlock, so exit.</SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">+&nbsp;&nbsp;&nbsp;&nbsp; 
// Because we hold the notify lock, no new notifications will occur on 
our<BR>+&nbsp;&nbsp;&nbsp;&nbsp; // target and it is safe to enqueue &amp; 
notify hereafter...</SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
queue_count = this-&gt;enqueue_i (new_item);</SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
if (queue_count == -1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
-1;</SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;notify (); </SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">+&nbsp;&nbsp; 
}; // e.o. notify guarded area.</SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">&nbsp; 
}<BR>&nbsp; return queue_count;<BR>}</SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">END FIX 
CODE 
EXAMPLE&nbsp;<BR>//==============================================================================</SPAN><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P>
<P class=MsoNormal><SPAN 
style="COLOR: blue; FONT-FAMILY: 'Courier New'">&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal>&nbsp;<o:p></o:p></P>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center>
<HR align=center width="100%" SIZE=2>
</DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 12pt"><B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">From:</SPAN></B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"> Johnny Willemsen 
[mailto:jwillemsen@remedy.nl] <BR><B>Sent:</B> woensdag 27 februari 2008 
13:08<BR><B>To:</B> Rudy Pot; ace-bugs@cs.wustl.edu<BR><B>Subject:</B> RE: 
[ace-bugs] [ACE_Message_Queue] notify PIPE block causes Select_Reactor 
deadlock.</SPAN><o:p></o:p></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Hi,<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Thanks 
for using the PRF form. I found the change below in svn <o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Johnny<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><B><SPAN 
style="FONT-SIZE: 10pt; COLOR: rosybrown; FONT-FAMILY: 'Courier New'">Sat Mar 22 
11:58:12 2003&nbsp; </SPAN></B><B><SPAN 
style="FONT-SIZE: 10pt; COLOR: cadetblue; FONT-FAMILY: 'Courier New'">Douglas C. 
Schmidt&nbsp; </SPAN></B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&lt;<SPAN 
style="COLOR: darkgoldenrod">schmidt@tango.doc.wustl.edu</SPAN>&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
* <B><SPAN style="COLOR: blue">ace/Message_Queue_T.cpp</SPAN></B>: Moved the 
notify() hook calls within<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp; the protection of the guard lock critical section to 
prevent<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp; race conditions on cleanup.&nbsp; Thanks to Ron Muck 
&lt;rlm@sdiusa.com&gt; <o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp; for this suggestion.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<DIV 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: blue 1.5pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: medium none">
<DIV>
<DIV 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">From:</SPAN></B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"> 
ace-bugs-bounces@cse.wustl.edu [mailto:ace-bugs-bounces@cse.wustl.edu] <B>On 
Behalf Of </B>Rudy Pot<BR><B>Sent:</B> Wednesday, February 27, 2008 11:29 
AM<BR><B>To:</B> ace-bugs@cs.wustl.edu<BR><B>Subject:</B> [ace-bugs] 
[ACE_Message_Queue] notify PIPE block causes Select_Reactor 
deadlock.<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p>&nbsp;</o:p></P>
<DIV>
<P class=MsoNormal><BR><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
ACE VERSION: 5.5.6</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
HOST MACHINE and OPERATING SYSTEM: i386, Linux 2.6.20-1.2933.fc6 
</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
TARGET MACHINE and OPERATING SYSTEM, if different from HOST: 
same.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><BR>&nbsp;&nbsp;&nbsp; 
COMPILER NAME AND VERSION (AND PATCHLEVEL): gcc 
4.1.1</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
CONTENTS OF $ACE_ROOT/ace/config.h:&nbsp; 
config-linux.h</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
CONTENTS OF $ACE_ROOT/include/makeinclude/platform_macros.GNU 
(unless<BR>&nbsp;&nbsp;&nbsp; this isn't used in this case, e.g., with Microsoft 
Visual C++):<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
platform-linux.GNU<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; 
AREA/CLASS/EXAMPLE AFFECTED: <BR>&nbsp;&nbsp;&nbsp; Message_Queue_T.cpp / 
ACE_Message_Queue&lt;ACE_SYNCH_USE&gt; / enqueue_prio<BR>&nbsp;&nbsp;&nbsp; ( 
But I think also:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ::enqueue_head, 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
::enqueue_deadline,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ::enqueue_tail 
)</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
See DESCRIPTION.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
DOES THE PROBLEM AFFECT:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
COMPILATION? NO<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
LINKING?&nbsp;&nbsp;&nbsp;&nbsp; 
NO<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXECUTION?&nbsp;&nbsp; 
YES<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OTHER (please specify)? 
NO</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
SYNOPSIS:<BR>&nbsp;&nbsp;&nbsp; Application sometimes hangs when main Reactor 
gets more busy. <BR>&nbsp;&nbsp;&nbsp; (e.g. due to significant increasing 
external events)<BR>&nbsp;&nbsp;&nbsp; Coredump shows:<BR>&nbsp;&nbsp;&nbsp; 1) 
Main Reactor thread is blocking to get the ACE_Message_Queue 
lock.<BR>&nbsp;&nbsp;&nbsp; 2) Multiple threads block on 
ACE_Select_Reactor_Notify-&gt; which ends up 
in<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt;ACE::send() -&gt; 
write().<BR>&nbsp;&nbsp;&nbsp; Result is deadlock. We have to kill the 
application for shutdown.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
I've read Sidebar17 of C++ Network Programming Volume 2 but our situation 
<BR>&nbsp;&nbsp;&nbsp; is different from what is stated there (no notify called 
from handle_* of<BR>&nbsp;&nbsp;&nbsp; event_handler but producer-consumer 
deadlock).</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><BR><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
DESCRIPTION:</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
The application in short.<BR>&nbsp;&nbsp;&nbsp; 
-------------------------<BR>&nbsp;&nbsp;&nbsp; The part of our program where 
this deadlock appears is dealing with <BR>&nbsp;&nbsp;&nbsp; processing messages 
from an embedded (CAN) network. <BR>&nbsp;&nbsp;&nbsp; There is a thread per CAN 
message center (hardware communication channel)<BR>&nbsp;&nbsp;&nbsp; which puts 
the received message into ACE_Message_Queue's, depending on 
who<BR>&nbsp;&nbsp;&nbsp; wants to observe the messages. These are the producer 
threads.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
The message queues belongs to observers who all have registered to 
get<BR>&nbsp;&nbsp;&nbsp; notified by one Reactor which runs in one main Reactor 
thread (consumer).<BR>&nbsp;&nbsp;&nbsp; (they also have registered themselves 
by the message center threads as being<BR>&nbsp;&nbsp;&nbsp;&nbsp; interested in 
the messages).</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
Problem cause<BR>&nbsp;&nbsp;&nbsp; --------------<BR>&nbsp;&nbsp;&nbsp; What 
can happen now is that the main Reactor, which is used for many other 
<BR>&nbsp;&nbsp;&nbsp; things in our application, temporarily got other work 
todo, and therefore<BR>&nbsp;&nbsp;&nbsp; the message center threads may fill up 
the ACE_Select_Reactor notification<BR>&nbsp;&nbsp;&nbsp; PIPE. This causes the 
message center threads (producers) to block on the <BR>&nbsp;&nbsp;&nbsp; (FULL) 
PIPE write().</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
The main Reactor thread (consumer), when ready with the other work, wants to 
<BR>&nbsp;&nbsp;&nbsp; proceed with handling the pending notifications, and so 
emptying the PIPE, <BR>&nbsp;&nbsp;&nbsp; but cannot do this because the current 
notification code also holds the <BR>&nbsp;&nbsp;&nbsp; message QUEUE lock! 
<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; See code description 
below:</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><BR><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; In 
Message_Queue_T.cpp<BR>&nbsp;&nbsp;&nbsp; 
======================<BR>&nbsp;&nbsp;&nbsp; 
ACE_Message_Queue&lt;ACE_SYNCH_USE&gt;::enqueue_prio,<BR>&nbsp;&nbsp;&nbsp; ( 
But also the code reveals:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
::enqueue_head, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
::enqueue_deadline,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ::enqueue_tail 
)</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">-------------------------------<BR>DEADLOCK 
CODE: (Above rev. 46096 until HEAD code)</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">template 
&lt;ACE_SYNCH_DECL&gt; 
int<BR>ACE_Message_Queue&lt;ACE_SYNCH_USE&gt;::enqueue_prio (ACE_Message_Block 
*new_item,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ACE_Time_Value *timeout)<BR>{<BR>&nbsp; ACE_TRACE 
("ACE_Message_Queue&lt;ACE_SYNCH_USE&gt;::enqueue_prio");<BR>&nbsp; int 
queue_count = 0;<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; ACE_GUARD_RETURN 
(ACE_SYNCH_MUTEX_T, ace_mon, this-&gt;lock_, -1);</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; if 
(this-&gt;state_ == 
ACE_Message_Queue_Base::DEACTIVATED)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; errno = 
ESHUTDOWN;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
-1;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; if 
(this-&gt;wait_not_full_cond (ace_mon, timeout) == 
-1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
queue_count = this-&gt;enqueue_i (new_item);</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; if 
(queue_count == -1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
-1;</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
this-&gt;notify ();&nbsp; &lt;&lt;&lt;&lt; ERROR DEADLOCK (When blocking on 
notify in scope of 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
buffer lock...)<BR>&nbsp; }<BR>&nbsp; return 
queue_count;<BR>}</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><BR><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; In 
above code snippet: <BR>&nbsp;&nbsp;&nbsp; this-&gt;notify (); Causes DEADLOCK 
when blocking on full notification pipe.<BR>&nbsp;&nbsp;&nbsp; This happens 
because &lt;notify()&gt; is now called within the scope of the 
<BR>&nbsp;&nbsp;&nbsp; ACE_GUARD_RETURN.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; In 
older versions of ACE, e.g. 5.3.1, the &lt;notify()&gt; was outside the 
scope<BR>&nbsp;&nbsp;&nbsp; of the GUARD and we never had this 
deadlock.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; In 
SUBVERSION ACE, I can see this has been changed after 
revision<BR>&nbsp;&nbsp;&nbsp;&nbsp; r.46096 of Message_Queue_T.cpp 
(ChangeLogTag:Sat Mar 22 11:58:12 2003)<BR>&nbsp;&nbsp;&nbsp; But I don't know 
why.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
See Message_Queue_T.cpp <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : enqueue_prio, 
enqueue_head, enqueue_deadline, enqueue_tail</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">-------------------------------<BR>NON 
DEADLOCK CODE (rev. 46096)<BR>&nbsp;&nbsp;&nbsp; 
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; 
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; 
if (queue_count == -1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
-1;</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp; }&nbsp; // 
e.o. scope ACE_GUARD_RETURN for queue lock.<BR>&nbsp; this-&gt;notify ();&nbsp; 
// NO deadlock here, notify will unblock as soon PIPE is 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// emptied.<BR>&nbsp; return queue_count;<BR>}</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><BR><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">-------------------------------<BR>Concerning 
Coredump parts:</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">[ consumer 
]</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Thread 1 (process 
16785):<BR>#0&nbsp; 0x009bc5d9 in __lll_mutex_lock_wait () from 
/lib/libpthread.so.0<BR>#1&nbsp; 0x009b8636 in _L_mutex_lock_85 () from 
/lib/libpthread.so.0<BR>#2&nbsp; 0x009b817d in pthread_mutex_lock () from 
/lib/libpthread.so.0<BR>#3&nbsp; 0x00a9f922 in ACE_OS::mutex_lock () from 
/usr/lib/libACE.so.5.5.6<BR>#4&nbsp; 0x00fd83c8 in 
ACE_Message_Queue&lt;ACE_MT_SYNCH&gt;::is_empty ()<BR>&nbsp;&nbsp; from 
/opt/lib/libgcp_datadump.so<BR>#5&nbsp; 0x0142d881 in 
can::CCanSvcDriverObserver::handle_output ()<BR>&nbsp;&nbsp; from 
/opt/lib/libcanResourceManager.so.2<BR>#6&nbsp; 0x00ac03f6 in 
ACE_Select_Reactor_Notify::dispatch_notify ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#7&nbsp; 0x00ac057a in 
ACE_Select_Reactor_Notify::handle_input ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#8&nbsp; 0x00ac14da in 
ACE_Select_Reactor_Notify::dispatch_notifications ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#9&nbsp; 0x00a5ef8e in 
ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task$base ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#10 0x00a5f5fd in 
ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task$base ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#11 0x00a65b03 in ACE_OS::gettimeofday () from 
/usr/lib/libACE.so.5.5.6<BR>#12 0x00abd0d3 in 
ACE_Reactor::run_reactor_event_loop ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#13 0x0804ae36 in main 
()</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">[&nbsp;producer 
]<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Thread 28 (process 
17023):<BR>#0&nbsp; 0x009bc8f1 in write () from /lib/libpthread.so.0<BR>#1&nbsp; 
0x00a55a3a in ACE::send () from /usr/lib/libACE.so.5.5.6<BR>#2&nbsp; 0x00ac082e 
in ACE_Select_Reactor_Notify::notify ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#3&nbsp; 0x00a5edcc in 
ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task$base ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#4&nbsp; 0x00abdce6 in ACE_Reactor::notify () from 
/usr/lib/libACE.so.5.5.6<BR>#5&nbsp; 0x00abeace in 
ACE_Reactor_Notification_Strategy::notify ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#6&nbsp; 0x0804b42a in 
ACE_Message_Queue&lt;ACE_MT_SYNCH&gt;::notify ()<BR>#7&nbsp; 0x00fd7fa2 in 
ACE_Message_Queue&lt;ACE_MT_SYNCH&gt;::enqueue_prio ()<BR>&nbsp;&nbsp; from 
/opt/lib/libgcp_datadump.so<BR>#8&nbsp; 0x0142d6f3 in 
can::CCanSvcDriverObserver::update ()<BR>&nbsp;&nbsp; from 
/opt/lib/libcanResourceManager.so.2<BR>#9&nbsp; 0x0143078d in 
can::CCanSvcDriver_Base::svc_Read ()<BR>&nbsp;&nbsp; from 
/opt/lib/libcanResourceManager.so.2<BR>#10 0x0143087f in 
can::CCanSvcDriverRemoteRequestImpl::svc ()<BR>&nbsp;&nbsp; from 
/opt/lib/libcanResourceManager.so.2<BR>#11 0x00ad3026 in ACE_Task_Base::svc_run 
() from /usr/lib/libACE.so.5.5.6<BR>#12 0x00ad39e8 in 
ACE_Thread_Adapter::invoke_i ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#13 0x00ad3bb6 in ACE_Thread_Adapter::invoke () from 
/usr/lib/libACE.so.5.5.6<BR>#14 0x00a67511 in ace_thread_adapter () from 
/usr/lib/libACE.so.5.5.6<BR>#15 0x009b626a in start_thread () from 
/lib/libpthread.so.0<BR>#16 0x92fff470 in ?? ()<BR>#17 0x92fff470 in ?? 
()<BR>#18 0x92fff470 in ?? ()<BR>#19 0x92fff470 in ?? ()<BR>#20 0x00000000 in ?? 
()</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">[&nbsp;producer 
]<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Thread 34 (process 
17012):<BR>#0&nbsp; 0x009bc8f1 in write () from /lib/libpthread.so.0<BR>#1&nbsp; 
0x00a55a3a in ACE::send () from /usr/lib/libACE.so.5.5.6<BR>#2&nbsp; 0x00ac082e 
in ACE_Select_Reactor_Notify::notify ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#3&nbsp; 0x00a5edcc in 
ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task$base ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#4&nbsp; 0x00abdce6 in ACE_Reactor::notify () from 
/usr/lib/libACE.so.5.5.6<BR>#5&nbsp; 0x00abeace in 
ACE_Reactor_Notification_Strategy::notify ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#6&nbsp; 0x0804b42a in 
ACE_Message_Queue&lt;ACE_MT_SYNCH&gt;::notify ()<BR>#7&nbsp; 0x00fd7fa2 in 
ACE_Message_Queue&lt;ACE_MT_SYNCH&gt;::enqueue_prio ()<BR>&nbsp;&nbsp; from 
/opt/lib/libgcp_datadump.so<BR>#8&nbsp; 0x0142d6f3 in 
can::CCanSvcDriverObserver::update ()<BR>&nbsp;&nbsp; from 
/opt/lib/libcanResourceManager.so.2<BR>#9&nbsp; 0x0143062b in 
can::CCanSvcDriver_Base::svc_Read ()<BR>&nbsp;&nbsp; from 
/opt/lib/libcanResourceManager.so.2<BR>#10 0x014308cd in 
can::CCanSvcDriverReadImpl::svc ()<BR>&nbsp;&nbsp; from 
/opt/lib/libcanResourceManager.so.2<BR>#11 0x00ad3026 in ACE_Task_Base::svc_run 
() from /usr/lib/libACE.so.5.5.6<BR>#12 0x00ad39e8 in 
ACE_Thread_Adapter::invoke_i ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#13 0x00ad3bb6 in ACE_Thread_Adapter::invoke () from 
/usr/lib/libACE.so.5.5.6<BR>#14 0x00a67511 in ace_thread_adapter () from 
/usr/lib/libACE.so.5.5.6<BR>#15 0x009b626a in start_thread () from 
/lib/libpthread.so.0<BR>#16 0x96bff470 in ?? ()<BR>#17 0x96bff470 in ?? 
()<BR>#18 0x96bff470 in ?? ()<BR>#19 0x96bff470 in ?? ()<BR>#20 0x00000000 in ?? 
()</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">[&nbsp;producer 
]<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Thread 26 (process 
17025):<BR>#0&nbsp; 0x009bc8f1 in write () from /lib/libpthread.so.0<BR>#1&nbsp; 
0x00a55a3a in ACE::send () from /usr/lib/libACE.so.5.5.6<BR>#2&nbsp; 0x00ac082e 
in ACE_Select_Reactor_Notify::notify ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#3&nbsp; 0x00a5edcc in 
ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task$base ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#4&nbsp; 0x00abdce6 in ACE_Reactor::notify () from 
/usr/lib/libACE.so.5.5.6<BR>#5&nbsp; 0x00abeace in 
ACE_Reactor_Notification_Strategy::notify ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#6&nbsp; 0x0804b42a in 
ACE_Message_Queue&lt;ACE_MT_SYNCH&gt;::notify ()<BR>#7&nbsp; 0x00fd7fa2 in 
ACE_Message_Queue&lt;ACE_MT_SYNCH&gt;::enqueue_prio ()<BR>&nbsp;&nbsp; from 
/opt/lib/libgcp_datadump.so<BR>#8&nbsp; 0x0142d6f3 in 
can::CCanSvcDriverObserver::update ()<BR>&nbsp;&nbsp; from 
/opt/lib/libcanResourceManager.so.2<BR>#9&nbsp; 0x0143078d in 
can::CCanSvcDriver_Base::svc_Read ()<BR>&nbsp;&nbsp; from 
/opt/lib/libcanResourceManager.so.2<BR>#10 0x0143087f in 
can::CCanSvcDriverRemoteRequestImpl::svc ()<BR>&nbsp;&nbsp; from 
/opt/lib/libcanResourceManager.so.2<BR>#11 0x00ad3026 in ACE_Task_Base::svc_run 
() from /usr/lib/libACE.so.5.5.6<BR>#12 0x00ad39e8 in 
ACE_Thread_Adapter::invoke_i ()<BR>&nbsp;&nbsp; from 
/usr/lib/libACE.so.5.5.6<BR>#13 0x00ad3bb6 in ACE_Thread_Adapter::invoke () from 
/usr/lib/libACE.so.5.5.6<BR>#14 0x00a67511 in ace_thread_adapter () from 
/usr/lib/libACE.so.5.5.6<BR>#15 0x009b626a in start_thread () from 
/lib/libpthread.so.0<BR>#16 0x91bff470 in ?? ()<BR>#17 0x91bff470 in ?? 
()<BR>#18 0x91bff470 in ?? ()<BR>#19 0x91bff470 in ?? ()<BR>#20 0x00000000 in ?? 
()</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><BR><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
REPEAT BY:<BR>&nbsp;&nbsp;&nbsp; See description</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; 
SAMPLE FIX/WORKAROUND:<BR>&nbsp;&nbsp;&nbsp; Change ACE code so that 
&lt;this-&gt;notify();&gt; is outside of GUARD scope?<BR>&nbsp;&nbsp;&nbsp; 
(like it was before in rev. 46096).</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">[* end of PRF 
*]</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Aside from this 
deadlock problem:</SPAN><o:p></o:p></P></DIV>
<DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">One thing what also 
comes up now is that I have to look at the notification 
pipe</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">buffer length too 
when I want&nbsp;to increase the&nbsp; ACE_Message_Queue 
size?</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">(enqueue will block 
if notification pipe is full). </SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Or,&nbsp;I have to 
use #define ACE_HAS_REACTOR_NOTIFICATION_QUEUE and</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">recompile 
ACE?</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Best 
regards,</SPAN><o:p></o:p></P></DIV></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P>
<DIV>
<P class=MsoNormal><STRONG><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Rudy&nbsp;Pot</SPAN></STRONG><o:p></o:p></P></DIV>
<DIV>
<DIV>
<DIV>
<DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Embedded Computer 
Systems</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><STRONG><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">AWETA G&amp;P 
b.v</SPAN></STRONG><o:p></o:p></P></DIV>
<DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Postbox 
17</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">NL-2630 AA&nbsp; 
Nootdorp</SPAN><o:p></o:p></P></DIV></DIV>
<DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">tel +31 (0)15 3109961 
</SPAN><o:p></o:p></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">fax&nbsp;+31 (0)15 
3107321 </SPAN><o:p></o:p></P>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">mail&nbsp;</SPAN><A 
href="mailto:rpot@aweta.nl"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">rpot@aweta.nl</SPAN></A><o:p></o:p></P></DIV>
<DIV>
<DIV>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">web <A 
href="blocked::http://www.aweta.com">www.aweta.com</A></SPAN><o:p></o:p></P></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></BODY></HTML>