<!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> </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> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=721330413-11032008>Below you can find 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> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=721330413-11032008>The original source was taken from 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> </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, the race condition is
not 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 had a segmentation fault only once and
unfortunately at that time 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> </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 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> </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 our compilers and the ACE versions used for
the different platforms (W32 BCB ACE-5.3.1, RH9 gcc
ACE-5.3.1, FC6 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, some minor change has been
made in 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> </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 below in this post. 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> </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> </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> 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> </DIV>
<DIV><SPAN class=904435009-11112005><FONT face=Arial color=#0000ff
size=2><STRONG>AWETA G&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
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 +31 (0)15 310<SPAN class=904435009-11112005>7321</SPAN> </FONT>
<DIV><SPAN class=904435009-11112005><FONT face=Arial color=#0000ff
size=2>mail </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> </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> </DIV>
<DIV dir=ltr align=left><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>// $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> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2>//
============================================================================<BR>//<BR>//
= LIBRARY<BR>// tests<BR>//<BR>// =
FILENAME<BR>// Message_Queue_Notification_Test.cpp<BR>//<BR>//
= DESCRIPTION<BR>// There are two tests that test
2 different notification<BR>// mechanisms in
Message Queue.<BR>//<BR>// The first test
illustrates the notification mechanisms in<BR>//
Message_Queue and its integration with
Reactor.<BR>//<BR>// Note the following things
about this part of the test:<BR>//<BR>// 1.
Multiple threads are not required.<BR>// 2. You do
not have to explicitly notify the Reactor<BR>// 3.
This code will work the same with any Reactor
Implementation<BR>// 4. handle_input,
handle_exception, handle_output are the
only<BR>// callbacks supported
by this mechanism<BR>// 5. The notification
mechanism need not notify the Reactor. You
can<BR>// write your own
strategy classes that can do whatever
application<BR>// specific
behavior you want.<BR>//<BR>// The second test
also makes sure the high/low water mark<BR>//
signaling mechanism works flawlessly.<BR>//<BR>//
The third test handles the use case of notification strategy in
<BR>// combination with EH "delete this"
termination.<BR>//<BR>// There is also a fourth
stress test added for addressing possible <BR>//
notification deadlocks. It look similar as the first test but needs
<BR>// threads. If deadlock occurs, this test has
to be killed to terminate.<BR>//<BR>// = AUTHOR<BR>// Irfan
Pyarali <<A href="mailto:irfan@cs.wustl.edu">irfan@cs.wustl.edu</A>> and
Nanbor Wang <<A
href="mailto:nanbor@cs.wustl.edu">nanbor@cs.wustl.edu</A>><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> </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> </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> </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> </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> </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> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2>#define TEST_CLOSEHOOK 1 // Test for
Message_Queue_T notify race conditions.<BR>#define TEST_FULLNOTIFY 1 //
Test for Message_Queue_T notify deadlock.</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff
size=2>//-----------------------------------------------------------------------------<BR>class
Message_Handler : public ACE_Task<ACE_NULL_SYNCH><BR>{<BR> // =
TITLE<BR> // This class implements a notification strategy for
the Reactor.<BR>public:<BR> // = Initialization and termination.<BR>
Message_Handler (ACE_Reactor &reactor);<BR> //
Constructor.</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> // = Demuxing hooks.<BR> virtual int
handle_input (ACE_HANDLE);<BR> virtual int handle_output (ACE_HANDLE fd =
ACE_INVALID_HANDLE);<BR> virtual int handle_exception (ACE_HANDLE fd =
ACE_INVALID_HANDLE);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2>private:<BR> int process_message (void);<BR>
void make_message (void);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> ACE_Reactor_Notification_Strategy
notification_strategy_;<BR>};</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff
size=2>//-----------------------------------------------------------------------------<BR>class
Watermark_Test : public ACE_Task<ACE_SYNCH><BR>{<BR> // =
TITLE<BR> // This class test the correct
functioning of build-in flow<BR> // control
machanism in ACE_Task.<BR>public:<BR> Watermark_Test
(void);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> virtual int svc (void);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> int consumer (void);<BR> int producer
(void);<BR> int put_message (ACE_Time_Value* timeout = 0);<BR> int
get_message (void);<BR> void print_producer_debug_message
(void);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2>private:<BR> const size_t len_;<BR> const
size_t hwm_;<BR> const size_t lwm_;<BR> ACE_Atomic_Op
<ACE_SYNCH_MUTEX, int> role_;<BR>#if defined (ACE_HAS_THREADS)<BR>
ACE_Barrier mq_full_;<BR> ACE_Barrier mq_low_water_mark_hit_;<BR>#endif /*
ACE_HAS_THREADS */<BR>};</FONT></SPAN></DIV>
<DIV> </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> </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<ACE_MT_SYNCH><BR>{<BR> // = TITLE<BR>
// This class tests the behaviour of the Task <close> hook
called in <BR> // combination with notified MB_STOP message
enqueing.<BR> // It should normally cause this dynamically
created task (EH) to <BR> // gracefully delete
itself.<BR>public:<BR> // = Initialization and termination.<BR>
CloseHook_Handler (ACE_Reactor &reactor);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> // = Demuxing hooks.<BR> virtual int
handle_input (ACE_HANDLE);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> // = Starts the threads needed for
testing.<BR> virtual int open (void *args = 0); </FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2>private:<BR> // = Ensure dynamic creation.<BR>
virtual ~CloseHook_Handler ();</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> // = Svc hook.<BR> virtual int svc
(void);<BR> // = Hook called from <ACE_Thread_Exit> during thread
exit.<BR> virtual int close (u_long flags = 0);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> ACE_Reactor_Notification_Strategy
notification_strategy_;<BR>
ACE_Barrier
startupBarrier_; <BR> ACE_Message_Block::ACE_Message_Type
messageType_;<BR>};<BR>#endif /* TEST_CLOSEHOOK */</FONT></SPAN></DIV>
<DIV> </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<ACE_MT_SYNCH><BR>{<BR> // = TITLE<BR> //
This class tests the behaviour of (notified) message enqueing at a point
<BR> // when the Reactor notification pipe is full. It should
then just block.<BR> // After the (consumer) Reactor eventloop
has handled some pending <BR> // notifications, the notifiers
(producer threads) should just get unblocked.<BR>public:<BR> // =
Initialization and termination.<BR> FullNotify_Handler (ACE_Reactor
&reactor);<BR> virtual ~FullNotify_Handler ();</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> // = Demuxing hooks.<BR> virtual int
handle_input (ACE_HANDLE);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> // = Starts the threads needed for
testing.<BR> virtual int open (void *args = 0); </FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2>private:<BR> // = Svc hook.<BR> virtual int svc
(void);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> void make_message (void);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> ACE_Reactor_Notification_Strategy
notification_strategy_;<BR> static const
int iMAX_NR_THREADS =
2;
<BR> // Identifiers needed when we have more than one thread
active.<BR>
ACE_thread_t
thread_ids_[iMAX_NR_THREADS]; <BR>};<BR>#endif /* TEST_FULLNOTIFY
*/</FONT></SPAN></DIV>
<DIV> </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> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff
size=2>//-----------------------------------------------------------------------------<BR>Message_Handler::Message_Handler
(ACE_Reactor &reactor)<BR> // First time handle_input will be
called<BR> : notification_strategy_
(&reactor,<BR>
this,<BR>
ACE_Event_Handler::READ_MASK)<BR>{<BR> this->msg_queue
()->notification_strategy (&this->notification_strategy_);<BR>
this->make_message ();<BR>}</FONT></SPAN></DIV>
<DIV> </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> ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("Message_Handler::handle_input\n")));</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> // Next time handle_output will be called.<BR>
this->notification_strategy_.mask
(ACE_Event_Handler::WRITE_MASK);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> return process_message ();<BR>}</FONT></SPAN></DIV>
<DIV> </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> ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("Message_Handler::handle_output\n")));<BR> ACE_UNUSED_ARG
(fd);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> // Next time handle_exception will be
called.<BR> this->notification_strategy_.mask
(ACE_Event_Handler::EXCEPT_MASK);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> return process_message ();<BR>}</FONT></SPAN></DIV>
<DIV> </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> ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("Message_Handler::handle_exception\n")));<BR> ACE_UNUSED_ARG
(fd);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> // Next time handle_input will be called.<BR>
this->notification_strategy_.mask
(ACE_Event_Handler::READ_MASK);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> return this->process_message
();<BR>}</FONT></SPAN></DIV>
<DIV> </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> ACE_Message_Block *mb;</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> if (this->getq
(mb,<BR>
(ACE_Time_Value *) &ACE_Time_Value::zero) == -1)<BR>
ACE_ERROR_RETURN
((LM_ERROR,<BR>
ACE_TEXT
("%p\n"),<BR>
ACE_TEXT
("dequeue_head")),<BR>
-1);<BR> else<BR> {<BR>
ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("message received =
%s\n"),<BR>
mb->rd_ptr ()));<BR> mb->release
();<BR> }</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> this->make_message ();<BR> return
0;<BR>}</FONT></SPAN></DIV>
<DIV> </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>
if (--iterations > 0)<BR>
{<BR> ACE_Message_Block
*mb;<BR> ACE_NEW
(mb,<BR>
ACE_Message_Block (default_message));</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("sending message\n")));<BR>
this->putq (mb);<BR> }<BR>}</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff
size=2>//-----------------------------------------------------------------------------<BR>Watermark_Test::Watermark_Test
(void)<BR> : len_ (ACE_OS::strlen (default_message) +
1),<BR> hwm_ (this->len_ *
default_high_water_mark),<BR> lwm_ (this->len_ *
default_low_water_mark),<BR> role_ (0)<BR>#if defined
(ACE_HAS_THREADS)<BR> , mq_full_
(worker_threads),<BR> mq_low_water_mark_hit_
(worker_threads)<BR>#endif /* ACE_HAS_THREADS */<BR>{<BR>
this->water_marks
(ACE_IO_Cntl_Msg::SET_LWM,<BR>
this->lwm_);<BR> this->water_marks
(ACE_IO_Cntl_Msg::SET_HWM,<BR>
this->hwm_);<BR>}</FONT></SPAN></DIV>
<DIV> </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> int i
= watermark_iterations;</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> for (ssize_t hwm =
this->hwm_;<BR> hwm >= 0
;<BR> hwm -=
this->len_)<BR> {<BR>
this->put_message ();<BR>
this->print_producer_debug_message ();<BR>
i--;<BR> if (this->msg_queue ()->is_full
())<BR> break;</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> }<BR> ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("(%P|%t) Producer: High water mark hit ----
\n")));</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> ACE_MT (this->mq_full_.wait
());</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> // The following put_message should block until the
message queue<BR> // has dropped under the lwm.<BR>
this->put_message ();</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> ACE_ASSERT (this->msg_queue ()-> message_bytes
() <= this->lwm_ + this->len_);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> this->print_producer_debug_message
();</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> for (i--; i >= 0 ; i--)<BR>
{<BR> this->put_message
();<BR> this->print_producer_debug_message
();<BR> }</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> return 0;<BR>}</FONT></SPAN></DIV>
<DIV> </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>
ACE_MT (this->mq_full_.wait ());</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> ACE_OS::sleep (1);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> // Let producer proceed and block in
putq.</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> for (int i = watermark_iterations; i >= 0;
i--)<BR> {<BR>
this->get_message ();<BR> ACE_OS::sleep
(0);<BR> }</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> return 0;<BR>}</FONT></SPAN></DIV>
<DIV> </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>
ACE_Message_Block *mb;</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> if (this->getq (mb) == -1)<BR>
ACE_ERROR_RETURN
((LM_ERROR,<BR>
ACE_TEXT
("%p\n"),<BR>
ACE_TEXT
("dequeue_head")),<BR>
-1);<BR> else<BR> {<BR>
ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("(%P|%t) Consumer: message size = %3d,
")<BR>
ACE_TEXT ("message count =
%3d\n"),<BR>
this->msg_queue ()-> message_bytes
(),<BR>
this->msg_queue ()-> message_count ()));<BR>
mb->release ();<BR> }</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> return 0;<BR>}</FONT></SPAN></DIV>
<DIV> </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> ACE_Message_Block *mb;</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> ACE_NEW_RETURN
(mb,<BR>
ACE_Message_Block
(default_message,<BR>
this->len_),<BR>
-1);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> return this->putq (mb,
timeout);<BR>}</FONT></SPAN></DIV>
<DIV> </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> ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("(%P|%t) Producer: message size = %3d,
")<BR>
ACE_TEXT ("message count =
%3d\n"),<BR>
this->msg_queue ()-> message_bytes
(),<BR>
this->msg_queue ()-> message_count ()));<BR>}</FONT></SPAN></DIV>
<DIV> </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> //
this->role_ is an Atomic_Op object.<BR> int role =
this->role_++;</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=721330413-11032008><FONT face=Arial
color=#0000ff size=2> switch (role)<BR>
{<BR> case 0:<BR>
this->producer ();<BR>
break;<BR> case 1:<BR>
this->consumer ();<BR>
break;<BR> default:<BR>
break;<BR> }<BR> return 0;<BR>}</FONT></SPAN></DIV>
<DIV> </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> </DIV>
<DIV dir=ltr align=left>#if defined (TEST_CLOSEHOOK)</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>CloseHook_Handler::CloseHook_Handler (ACE_Reactor
&reactor)<BR> : notification_strategy_
(&reactor,<BR>
this,<BR>
ACE_Event_Handler::READ_MASK)<BR> ,
startupBarrier_(2) // Barrier for
ourself and the new thread.<BR> ,
messageType_(ACE_Message_Block::MB_NORMAL)<BR>{<BR>
this->msg_queue()->notification_strategy
(&this->notification_strategy_);<BR>}</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>CloseHook_Handler::~CloseHook_Handler()<BR>{<BR>
if (this->reactor() != 0)<BR> {<BR> // Remove ourself
from reactor Eh queue (don't call handle_close).<BR>
this->reactor()->remove_handler(this,<BR>
ACE_Event_Handler::READ_MASK
|<BR>
ACE_Event_Handler::DONT_CALL );<BR> this->reactor(0);
<BR> };<BR>}</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>int<BR>CloseHook_Handler::handle_input
(ACE_HANDLE)<BR>{<BR> ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("CloseHook_Handler::handle_input\n")));</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> // All messages handled in svc().<BR>
return 0; // Stay registered.<BR>}</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>int<BR>CloseHook_Handler::open (void
*args)<BR>{<BR> ACE_UNUSED_ARG (args);<BR> if
(this->activate(THR_NEW_LWP | THR_DETACHED) < 0)<BR>
{<BR> ACE_ERROR_RETURN
((LM_ERROR<BR>
,ACE_TEXT ("CloseHook_Handler::open, activate
ERROR(%s)!\n")<BR>
,strerror(ACE_OS::last_error())<BR>
),-1);<BR> };<BR> startupBarrier_.wait();<BR> return
0;<BR>}</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>int<BR>CloseHook_Handler::svc
(void)<BR>{<BR>ACE_Message_Block *pMb=0;</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> startupBarrier_.wait();<BR> while
(messageType_ != ACE_Message_Block::MB_STOP)<BR> {<BR>
if (this->msg_queue()->dequeue_head(pMb) >= 0) // Block on input
queue.<BR> {<BR> messageType_ =
pMb->msg_type();<BR>
pMb->release();<BR> ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("CloseHook_Handler::svc[t=%t]:
pMb->release()\n")));<BR> }<BR>
else<BR> {<BR> ACE_DEBUG
((LM_WARNING,<BR>
ACE_TEXT ("CloseHook_Handler::svc: Invalid message
dequeued!\n")<BR>
));<BR> };<BR> };<BR> return 0;<BR>}</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>int <BR>CloseHook_Handler::close (u_long
flags)<BR>{<BR> ACE_UNUSED_ARG (flags);<BR> ACE_DEBUG
((LM_DEBUG,ACE_TEXT ("CloseHook_Handler::close hook called.\n")));<BR> //
Service thread has exited, and this object is now invalid.<BR> delete
this;<BR> return 0;<BR>}</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>#endif /* TEST_CLOSEHOOK */</DIV>
<DIV> </DIV>
<DIV dir=ltr
align=left>//-----------------------------------------------------------------------------<BR>#if
defined (TEST_FULLNOTIFY)</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>FullNotify_Handler::FullNotify_Handler (ACE_Reactor
&reactor)<BR> : notification_strategy_
(&reactor,<BR>
this,<BR>
ACE_Event_Handler::READ_MASK)<BR>{<BR>
this->reactor(&reactor);<BR>
this->msg_queue()->notification_strategy
(&this->notification_strategy_);<BR>}</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>FullNotify_Handler::~FullNotify_Handler()<BR>{<BR>
this->wait();<BR>}</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>int<BR>FullNotify_Handler::handle_input
(ACE_HANDLE)<BR>{<BR> ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("FullNotify_Handler::handle_input\n")));</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> ACE_Message_Block *mb;</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> if
(this->msg_queue()->is_empty())<BR> ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("Message queue is
empty!\n")<BR>
));<BR> else if (this->getq
(mb,<BR>
(ACE_Time_Value *) &ACE_Time_Value::zero) == -1)<BR>
ACE_ERROR_RETURN
((LM_ERROR,<BR>
ACE_TEXT
("%p\n"),<BR>
ACE_TEXT
("dequeue_head")),<BR>
-1);<BR> else<BR> {<BR>
ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("message received =
%s\n"),<BR>
mb->rd_ptr ()));<BR> mb->release
();<BR> }</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> return 0; // Stay registered.<BR>}</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>int<BR>FullNotify_Handler::open (void
*args)<BR>{<BR> ACE_UNUSED_ARG (args);<BR> // Activate the threads:
Most are default parms, except n_threads <BR> // and
thread_ids_.<BR> // thread_ids_ is used to distinguise between the
threads.<BR> if
(this->activate(
// Activate the svc()
<BR>
THR_NEW_LWP | THR_JOINABLE // (default)
flags.<BR>
,iMAX_NR_THREADS
// - n_threads
<BR>
,0
// (default)
force_active<BR>
,ACE_DEFAULT_THREAD_PRIORITY // (default)
priority<BR>
,-1
// (default)
grp_id<BR>
,0
// (default)
*task<BR>
,0
// (default)
thread_handles[]<BR>
,0
// (default)
*stack[]<BR>
,0
// (default)
stack_size[]<BR>
,thread_ids_
// - thread_ids[]
<BR>
) < 0)<BR> {<BR> ACE_ERROR_RETURN
((LM_ERROR<BR>
,ACE_TEXT ("FullNotify_Handler::open, activate
ERROR(%s)!\n")<BR>
,strerror(ACE_OS::last_error())<BR>
),-1);<BR> };<BR> return 0;<BR>}</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>int<BR>FullNotify_Handler::svc (void)<BR>{<BR>int
iNotifications=0;</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> //ACE_DEBUG((LM_ERROR, ">>
FullNotify_Handler::svc(%t)\n"));<BR>
//--------------------------------------------<BR> if (ACE_Thread::self()
== thread_ids_[0]) <BR> {<BR> // [Thread
0]<BR> // Hit the reactor's notification queue until it is
full.<BR> // We can only continue if main thread handles the
reactor notifications.<BR> // Global 'iterations' will
countdown if next thread performs 'make_message'.<BR> while
(iterations > 0)<BR> {<BR>
ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("(%t) Reactor notification
(%d)\n")<BR>
,iNotifications++<BR>
));</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> // Notify the Reactor,
which will call our <handle_input>.<BR> //
Timeout when notify pipe is full? Somehow it isn't full when
timeout<BR> //
occurs.<BR> // FC6:
<BR> // - With timeout
parm: 108 x notify until timeout
occurs.<BR> // - Without timeout parm: 432 x
notify until it blocks.<BR> //ACE_Time_Value
timeout (10);<BR> //this-reactor()->notify
(this, ACE_Event_Handler::READ_MASK, &timeout);</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>
this->reactor()->notify (this,
ACE_Event_Handler::READ_MASK);<BR> };<BR> }<BR>
//--------------------------------------------<BR> else if
(ACE_Thread::self() == thread_ids_[1])<BR> {<BR> //
[Thread 1]<BR> // Use Message_Queue and hit the notification
queue again (blocks).<BR> // We can only continue if main
thread handles the reactor notifications.</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> // Sleep some time until notification
pipe is full?<BR> ACE_OS::sleep(2); <BR>
while (iterations > 0)<BR>
{<BR>
this->make_message();<BR> };<BR> };</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> //ACE_DEBUG((LM_ERROR, "<<
FullNotify_Handler::svc(%t)\n"));<BR> return 0;<BR>}</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>void<BR>FullNotify_Handler::make_message
(void)<BR>{<BR> if (--iterations > 0)<BR>
{<BR> ACE_Message_Block
*mb;<BR> ACE_NEW
(mb,<BR>
ACE_Message_Block (default_message));</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("sending message\n")));<BR>
this->putq (mb);<BR> }<BR>}</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>#endif /* TEST_FULLNOTIFY */<BR>#endif /*
ACE_HAS_THREADS */</DIV>
<DIV> </DIV>
<DIV dir=ltr
align=left>//-----------------------------------------------------------------------------<BR>int<BR>//run_main
(int, ACE_TCHAR *[])<BR>ACE_TMAIN (int, ACE_TCHAR *[])<BR>{<BR>
ACE_START_TEST (ACE_TEXT ("Message_Queue_Notifications_Test"));</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> {<BR> ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("\nStarting message queue reactive notification
test...\n")));<BR> <BR> ACE_Reactor
reactor;<BR> Message_Handler mh (reactor);<BR>
<BR> while (iterations >
0)<BR> reactor.handle_events ();<BR>
}<BR>#if defined (ACE_HAS_THREADS)<BR> {<BR> ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("\nStarting message queue watermark
test...\n")));<BR> Watermark_Test
watermark_test;<BR> ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("High water mark is
%d\n")<BR>
ACE_TEXT ("Low water mark is
%d\n"),<BR>
default_high_water_mark,<BR>
default_low_water_mark));<BR> <BR>
watermark_test.activate (THR_NEW_LWP |
THR_DETACHED,<BR>
worker_threads);</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> // This frees the memory used by the
DETACHED thread.<BR> ACE_Thread_Manager::instance ()->wait
();<BR> }<BR>#else<BR> ACE_DEBUG
((LM_INFO,<BR>
ACE_TEXT ("Message queue watermark test not performed because threads are not
supported\n")));<BR>#endif /* ACE_HAS_THREADS */</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>#if !defined (TEST_CLOSEHOOK)<BR> ACE_DEBUG
((LM_INFO,<BR>
ACE_TEXT ("Task <close> hook trigger test not used.\n")));<BR>#elif
defined (ACE_HAS_THREADS)<BR> {<BR> ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("\nStarting test: Task <close> hook triggered by notified
message enqueue...\n")));</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>
ACE_Reactor
reactor;<BR> CloseHook_Handler* pChh =
0;<BR> ACE_Message_Block* pMBlk = 0;</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> for (int iIterations=0;
iIterations<10; iIterations++)<BR>
{<BR> // Dynamically allocate Task EH which
deletes itself after MB_STOP <BR> // is
received.<BR> ACE_NEW_RETURN (pChh,
CloseHook_Handler(reactor), -1);<BR> <BR> //
Start svc thread.<BR> pChh->open();</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> // Just enqueue some
normal messages.<BR> ACE_NEW_RETURN( pMBlk,
ACE_Message_Block(0, ACE_Message_Block::MB_NORMAL),
-1);<BR> pChh->putq( pMBlk
);<BR> ACE_NEW_RETURN( pMBlk, ACE_Message_Block(0,
ACE_Message_Block::MB_NORMAL), -1);<BR>
pChh->putq( pMBlk );<BR> ACE_NEW_RETURN( pMBlk,
ACE_Message_Block(0, ACE_Message_Block::MB_NORMAL),
-1);<BR> pChh->putq( pMBlk );</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> // Quit svc thread and
let task delete itself (and see what happens).<BR>
ACE_NEW_RETURN( pMBlk, ACE_Message_Block(0, ACE_Message_Block::MB_STOP),
-1);<BR> pChh->putq( pMBlk );</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> // This frees the memory
used by the DETACHED thread.<BR>
ACE_Thread_Manager::instance ()->wait ();<BR> };</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> }<BR>#else<BR> ACE_DEBUG
((LM_INFO,<BR>
ACE_TEXT ("Task <close> hook trigger test not performed because threads
are not supported\n")));<BR>#endif /* ACE_HAS_THREADS */</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>#if !defined (TEST_FULLNOTIFY)<BR> ACE_DEBUG
((LM_INFO,<BR>
ACE_TEXT ("Blocking (full) notification test not used.\n")));<BR>#elif defined
(ACE_HAS_THREADS)<BR> {<BR> ACE_DEBUG
((LM_DEBUG,<BR>
ACE_TEXT ("\nStarting test: message enqueue with blocking (full)
notification...\n")));</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> // Global message enqueue
iterations.<BR> iterations = 10; </DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> ACE_Reactor
reactor;<BR> FullNotify_Handler fnh (reactor); </DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> // Start producer
threads.<BR> fnh.open();</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> // Sleep until notification pipe is
full and all producer threads block.<BR> ACE_OS::sleep(4);
</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> // Empty the notification pipe so
producers should normally unblock.<BR> while (iterations >
0)<BR> reactor.handle_events ();<BR>
}<BR>#else<BR> ACE_DEBUG
((LM_INFO,<BR>
ACE_TEXT ("Message enqueue with full notification test not performed because
threads are not supported\n")));<BR>#endif /* ACE_HAS_THREADS */</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> ACE_END_TEST;<BR> 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’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> </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> </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> </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> </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> </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> </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> </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> </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 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. <o:p></o:p></SPAN></P>
<P class=MsoNormal><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'">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> </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> </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> </o:p></P>
<P class=MsoPlainText> if (_msg_queue)
_msg_queue->enqueue_head(mb);<o:p></o:p></P>
<P class=MsoPlainText><o:p> </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> </o:p></P>
<P class=MsoPlainText>template <ACE_SYNCH_DECL> int<o:p></o:p></P>
<P class=MsoPlainText>ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_head
(ACE_Message_Block *new_item,<o:p></o:p></P>
<P
class=MsoPlainText>
ACE_Time_Value *timeout) {<o:p></o:p></P>
<P class=MsoPlainText> ACE_TRACE
("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_head");<o:p></o:p></P>
<P class=MsoPlainText> int queue_count = 0;<o:p></o:p></P>
<P class=MsoPlainText> {<o:p></o:p></P>
<P class=MsoPlainText> ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T,
ace_mon, this->lock_, -1);<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText> if (this->state_ ==
ACE_Message_Queue_Base::DEACTIVATED)<o:p></o:p></P>
<P class=MsoPlainText> {<o:p></o:p></P>
<P class=MsoPlainText> errno =
ESHUTDOWN;<o:p></o:p></P>
<P class=MsoPlainText> return
-1;<o:p></o:p></P>
<P class=MsoPlainText> }<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText> if (this->wait_not_full_cond
(ace_mon, timeout) == -1)<o:p></o:p></P>
<P class=MsoPlainText> return -1;<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText> queue_count = this->enqueue_head_i
(new_item);<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText> if (queue_count == -1)<o:p></o:p></P>
<P class=MsoPlainText> return -1;<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText>=> this->notify ();<o:p></o:p></P>
<P class=MsoPlainText> }<o:p></o:p></P>
<P class=MsoPlainText> return queue_count;<o:p></o:p></P>
<P class=MsoPlainText>}<o:p></o:p></P>
<P class=MsoPlainText><o:p> </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> </o:p></P>
<P class=MsoPlainText>
ACEd.dll!ACE_Reactor_Notification_Strategy::notify() Line
29<o:p></o:p></P>
<P class=MsoPlainText>C++<o:p></o:p></P>
<P class=MsoPlainText>
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>
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> </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> </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>
ACE_Reactor_Mask mask,<o:p></o:p></P>
<P
class=MsoPlainText>
ACE_Time_Value *timeout) {<o:p></o:p></P>
<P class=MsoPlainText> if (event_handler != 0)<o:p></o:p></P>
<P class=MsoPlainText> {<o:p></o:p></P>
<P class=MsoPlainText> ACE_Message_Block *mb =
0;<o:p></o:p></P>
<P class=MsoPlainText> ACE_NEW_RETURN
(mb,<o:p></o:p></P>
<P
class=MsoPlainText>
ACE_Message_Block (sizeof (ACE_Notification_Buffer)),<o:p></o:p></P>
<P
class=MsoPlainText>
-1);<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText> ACE_Notification_Buffer
*buffer =<o:p></o:p></P>
<P class=MsoPlainText>
(ACE_Notification_Buffer *) mb->base ();<o:p></o:p></P>
<P class=MsoPlainText> buffer->eh_ =
event_handler;<o:p></o:p></P>
<P class=MsoPlainText> buffer->mask_ =
mask;<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText> // Convert from relative
time to absolute time by adding the<o:p></o:p></P>
<P class=MsoPlainText> // current time of
day. This is what <ACE_Message_Queue><o:p></o:p></P>
<P class=MsoPlainText> // expects.<o:p></o:p></P>
<P class=MsoPlainText> if (timeout !=
0)<o:p></o:p></P>
<P class=MsoPlainText> *timeout +=
timer_queue_->gettimeofday ();<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText>=> if
(this->message_queue_.enqueue_tail<o:p></o:p></P>
<P class=MsoPlainText>
(mb, timeout) == -1)<o:p></o:p></P>
<P class=MsoPlainText>
{<o:p></o:p></P>
<P class=MsoPlainText>
mb->release ();<o:p></o:p></P>
<P class=MsoPlainText>
return -1;<o:p></o:p></P>
<P class=MsoPlainText>
}<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText>
event_handler->add_reference ();<o:p></o:p></P>
<P class=MsoPlainText> }<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText> return this->wakeup_one_thread_.signal ();
}<o:p></o:p></P>
<P class=MsoPlainText><o:p> </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> </o:p></P>
<P class=MsoPlainText>
message_queue_ {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<ACE_MT_SYNCH>
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>
head_ 0x000000006deaf1d0 {rd_ptr_=0 wr_ptr_=0<o:p></o:p></P>
<P class=MsoPlainText>priority_=0 ...} ACE_Message_Block *<o:p></o:p></P>
<P
class=MsoPlainText>
tail_ 0x000000007a5826b0 {rd_ptr_=0 wr_ptr_=0<o:p></o:p></P>
<P class=MsoPlainText>priority_=0 ...} ACE_Message_Block *<o:p></o:p></P>
<P
class=MsoPlainText>
low_water_mark_ 16384 unsigned __int64<o:p></o:p></P>
<P
class=MsoPlainText>
high_water_mark_ 16384 unsigned __int64<o:p></o:p></P>
<P
class=MsoPlainText>
cur_bytes_ 16384 unsigned __int64<o:p></o:p></P>
<P
class=MsoPlainText>
cur_length_ 0 unsigned __int64<o:p></o:p></P>
<P
class=MsoPlainText>
cur_count_ 1024 unsigned __int64<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText>template <ACE_SYNCH_DECL> int<o:p></o:p></P>
<P class=MsoPlainText>ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_tail
(ACE_Message_Block *new_item,<o:p></o:p></P>
<P
class=MsoPlainText>
ACE_Time_Value *timeout) {<o:p></o:p></P>
<P class=MsoPlainText> ACE_TRACE
("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_tail");<o:p></o:p></P>
<P class=MsoPlainText> int queue_count = 0;<o:p></o:p></P>
<P class=MsoPlainText> {<o:p></o:p></P>
<P class=MsoPlainText> ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T,
ace_mon, this->lock_, -1);<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText> if (this->state_ ==
ACE_Message_Queue_Base::DEACTIVATED)<o:p></o:p></P>
<P class=MsoPlainText> {<o:p></o:p></P>
<P class=MsoPlainText> errno =
ESHUTDOWN;<o:p></o:p></P>
<P class=MsoPlainText> return
-1;<o:p></o:p></P>
<P class=MsoPlainText> }<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText>=> if (this->wait_not_full_cond
(ace_mon, timeout) == -1)<o:p></o:p></P>
<P class=MsoPlainText> return -1;<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText> queue_count = this->enqueue_tail_i
(new_item);<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText> if (queue_count == -1)<o:p></o:p></P>
<P class=MsoPlainText> return -1;<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText> this->notify ();<o:p></o:p></P>
<P class=MsoPlainText> }<o:p></o:p></P>
<P class=MsoPlainText> return queue_count;<o:p></o:p></P>
<P class=MsoPlainText>}<o:p></o:p></P>
<P class=MsoPlainText><o:p> </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> </o:p></SPAN></P>
<P class=MsoNormal><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> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p> </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> </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> </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> </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> </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> </o:p></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Johnny,
I didn’t mean any offense. You do confirm my observation with the statement:
“people don't have time anymore to just fix these kind of issues without
funding”. I am sorry that this is the case, as I really like ACE. But I
strongly feel that 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’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> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Now
again that’s fine with me, and I certainly don’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’s overview: “</SPAN>ACE continues to improve and its <A
href="http://www.cs.wustl.edu/%7Eschmidt/ACE-future.html">future</A> is
bright”.<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> </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> </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> </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> </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> </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> </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> </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 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> </o:p></SPAN></P>
<P class=MsoPlainText>template <ACE_SYNCH_DECL> int<o:p></o:p></P>
<P class=MsoPlainText>ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_head
(ACE_Message_Block *new_item,<o:p></o:p></P>
<P
class=MsoPlainText>
ACE_Time_Value *timeout) {<o:p></o:p></P>
<P class=MsoPlainText> ACE_TRACE
("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_head");<o:p></o:p></P>
<P class=MsoPlainText> int queue_count = 0;<o:p></o:p></P>
<P class=MsoPlainText> {<o:p></o:p></P>
<P class=MsoPlainText> ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T,
ace_mon, this->lock_, -1);<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText> if (this->state_ ==
ACE_Message_Queue_Base::DEACTIVATED)<o:p></o:p></P>
<P class=MsoPlainText> {<o:p></o:p></P>
<P class=MsoPlainText> errno =
ESHUTDOWN;<o:p></o:p></P>
<P class=MsoPlainText> return
-1;<o:p></o:p></P>
<P class=MsoPlainText> }<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText> if (this->wait_not_full_cond
(ace_mon, timeout) == -1)<o:p></o:p></P>
<P class=MsoPlainText> return -1;<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText> queue_count = this->enqueue_head_i
(new_item);<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText> if (queue_count == -1)<o:p></o:p></P>
<P class=MsoPlainText> return -1;<o:p></o:p></P>
<P class=MsoPlainText><o:p> </o:p></P>
<P class=MsoPlainText>=> this->notify ();<o:p></o:p></P>
<P class=MsoPlainText> }<o:p></o:p></P>
<P class=MsoPlainText> 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> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p> </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> </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> <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> <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> <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> <o:p></o:p></P></DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">1) Sun
May 5 19:14:34 2002 Douglas C. Schmidt <<A
href="mailto:schm...@macarena.cs.wustl.edu">schm...@macarena.cs.wustl.edu</A>></SPAN><o:p></o:p></P>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">
* ace/Message_Queue_T.cpp: Modified all the enqueue*() methods so
that<BR> their calls to
notify() occur *outside* of the monitor
lock.<BR> This change
prevents deadlock from occurring when a
reactor's<BR> notification
pipe is full. Thanks to Sasha
Agranov<BR> <<A
href="mailto:sagra...@COMGATES.co.il">sagra...@COMGATES.co.il</A>> for
reporting this.</SPAN><o:p></o:p></P>
<DIV>
<P class=MsoNormal> <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 Douglas C. Schmidt <<A
href="mailto:schm...@tango.doc.wustl.edu">schm...@tango.doc.wustl.edu</A>></SPAN><o:p></o:p></P>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">
* ace/Message_Queue_T.cpp: Moved the notify() hook calls
within<BR> the protection
of the guard lock critical section to
prevent<BR> race
conditions on cleanup. Thanks to Ron Muck <<A
href="mailto:r...@sdiusa.com">r...@sdiusa.com</A>><BR>
for this suggestion. </SPAN><o:p></o:p></P>
<DIV>
<P class=MsoNormal> <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> <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> <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">
<MessageQueue1,
lock1>
handle_*<BR>
[Producer-1]-enqueue-->[|||||||||||||||||||||||||]--->[EH-1]
<-----+<BR>
|
\<BR>
\ <notifyLock>
<PIPE?>
|<BR>
+-notify----->[|||||||||||||||||||||]--->[Reactor]---+<BR>
/
(consumer)
|<BR>
|
/<BR>
| <MessageQueue-n,
lock-n>
/<BR>
[Producer-n]-enqueue-->[|||||||||||||||||||||||||]--->[EH-n] <----+
<BR>
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'"> <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'"> <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'"> <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'"> <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'"> <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 (changes applicable for: enqueue_prio, enqueue_head,
<BR>
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'"> <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
<ACE_SYNCH_DECL>
int<BR>ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_prio (ACE_Message_Block
*new_item,<BR>
ACE_Time_Value *timeout)<BR>{<BR> ACE_TRACE
("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_prio");<BR> int
queue_count = 0;<BR> {<BR> ACE_GUARD_RETURN
(ACE_SYNCH_MUTEX_T, ace_mon, this->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'"> <o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">
if (this->state_ ==
ACE_Message_Queue_Base::DEACTIVATED)<BR>
{<BR> errno =
ESHUTDOWN;<BR> return
-1;<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'"> <o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">
if (this->wait_not_full_cond (ace_mon, timeout) ==
-1)<BR> 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'"> <o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">+
{<BR>+ ACE_GUARD_RETURN
(ACE_SYNCH_MUTEX_T<BR>+
,ace_notify_mon<BR>+
// Would be handy if
ACE_Notification_Strategy<BR>+
// has a lock. To be gathered from notify
target<BR>+
//
(reactor?)<BR>+
// Problem: ACE_Reactor_Notification_Strategy has stored
<BR>+
// Reactor reference but ACE_Notification_Strategy
not.<BR>+
,this->notification_strategy->lock()<BR>+
, -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'"> <o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">+
// Somehow check if the (reactor?) notification channel is
full.<BR>+ // Probably needs
this->notification_strategy too.<BR>+ if
(this->wait_no_notify_full_cond (ace_notify_mon, timeout) ==
-1)<BR>+ 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'"> <o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">+
// Because we hold the notify lock, no new notifications will occur on
our<BR>+ // target and it is safe to enqueue &
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'"> <o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">
queue_count = this->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'"> <o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">
if (queue_count == -1)<BR> 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'"> <o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">
this->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'"> <o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">+
}; // 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'"> <o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">
}<BR> 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'"> <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 <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'"> <o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal> <o:p></o:p></P>
<P class=MsoNormal><SPAN
style="COLOR: blue; FONT-FAMILY: 'Courier New'"> <o:p></o:p></SPAN></P>
<P class=MsoNormal> <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> </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> </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> </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 </SPAN></B><B><SPAN
style="FONT-SIZE: 10pt; COLOR: cadetblue; FONT-FAMILY: 'Courier New'">Douglas C.
Schmidt </SPAN></B><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><<SPAN
style="COLOR: darkgoldenrod">schmidt@tango.doc.wustl.edu</SPAN>><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
* <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'">
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'">
race conditions on cleanup. Thanks to Ron Muck
<rlm@sdiusa.com> <o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
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> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p> </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> </o:p></P>
<DIV>
<P class=MsoNormal><BR><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
ACE VERSION: 5.5.6</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
HOST MACHINE and OPERATING SYSTEM: i386, Linux 2.6.20-1.2933.fc6
</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
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>
COMPILER NAME AND VERSION (AND PATCHLEVEL): gcc
4.1.1</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
CONTENTS OF $ACE_ROOT/ace/config.h:
config-linux.h</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
CONTENTS OF $ACE_ROOT/include/makeinclude/platform_macros.GNU
(unless<BR> this isn't used in this case, e.g., with Microsoft
Visual C++):<BR>
platform-linux.GNU<BR> <BR>
AREA/CLASS/EXAMPLE AFFECTED: <BR> Message_Queue_T.cpp /
ACE_Message_Queue<ACE_SYNCH_USE> / enqueue_prio<BR> (
But I think also:<BR> ::enqueue_head,
<BR>
::enqueue_deadline,<BR> ::enqueue_tail
)</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
See DESCRIPTION.
</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
DOES THE PROBLEM AFFECT:<BR>
COMPILATION? NO<BR>
LINKING?
NO<BR> EXECUTION?
YES<BR> OTHER (please specify)?
NO</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
SYNOPSIS:<BR> Application sometimes hangs when main Reactor
gets more busy. <BR> (e.g. due to significant increasing
external events)<BR> Coredump shows:<BR> 1)
Main Reactor thread is blocking to get the ACE_Message_Queue
lock.<BR> 2) Multiple threads block on
ACE_Select_Reactor_Notify-> which ends up
in<BR> ->ACE::send() ->
write().<BR> Result is deadlock. We have to kill the
application for shutdown.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
I've read Sidebar17 of C++ Network Programming Volume 2 but our situation
<BR> is different from what is stated there (no notify called
from handle_* of<BR> event_handler but producer-consumer
deadlock).</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><BR><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
DESCRIPTION:</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
The application in short.<BR>
-------------------------<BR> The part of our program where
this deadlock appears is dealing with <BR> processing messages
from an embedded (CAN) network. <BR> There is a thread per CAN
message center (hardware communication channel)<BR> which puts
the received message into ACE_Message_Queue's, depending on
who<BR> wants to observe the messages. These are the producer
threads.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
The message queues belongs to observers who all have registered to
get<BR> notified by one Reactor which runs in one main Reactor
thread (consumer).<BR> (they also have registered themselves
by the message center threads as being<BR> interested in
the messages).</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
Problem cause<BR> --------------<BR> What
can happen now is that the main Reactor, which is used for many other
<BR> things in our application, temporarily got other work
todo, and therefore<BR> the message center threads may fill up
the ACE_Select_Reactor notification<BR> PIPE. This causes the
message center threads (producers) to block on the <BR> (FULL)
PIPE write().</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
The main Reactor thread (consumer), when ready with the other work, wants to
<BR> proceed with handling the pending notifications, and so
emptying the PIPE, <BR> but cannot do this because the current
notification code also holds the <BR> message QUEUE lock!
<BR> <BR> See code description
below:</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><BR><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> In
Message_Queue_T.cpp<BR>
======================<BR>
ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_prio,<BR> (
But also the code reveals:<BR>
::enqueue_head, <BR>
::enqueue_deadline,<BR> ::enqueue_tail
)</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <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> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">template
<ACE_SYNCH_DECL>
int<BR>ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_prio (ACE_Message_Block
*new_item,<BR>
ACE_Time_Value *timeout)<BR>{<BR> ACE_TRACE
("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_prio");<BR> int
queue_count = 0;<BR> {<BR> ACE_GUARD_RETURN
(ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1);</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> if
(this->state_ ==
ACE_Message_Queue_Base::DEACTIVATED)<BR>
{<BR> errno =
ESHUTDOWN;<BR> return
-1;<BR> }</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> if
(this->wait_not_full_cond (ace_mon, timeout) ==
-1)<BR> return -1;</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
queue_count = this->enqueue_i (new_item);</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> if
(queue_count == -1)<BR> return
-1;</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
this->notify (); <<<< ERROR DEADLOCK (When blocking on
notify in scope of
<BR>
buffer lock...)<BR> }<BR> return
queue_count;<BR>}</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><BR><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> In
above code snippet: <BR> this->notify (); Causes DEADLOCK
when blocking on full notification pipe.<BR> This happens
because <notify()> is now called within the scope of the
<BR> ACE_GUARD_RETURN.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> In
older versions of ACE, e.g. 5.3.1, the <notify()> was outside the
scope<BR> of the GUARD and we never had this
deadlock.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> In
SUBVERSION ACE, I can see this has been changed after
revision<BR> r.46096 of Message_Queue_T.cpp
(ChangeLogTag:Sat Mar 22 11:58:12 2003)<BR> But I don't know
why.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
See Message_Queue_T.cpp <BR> : enqueue_prio,
enqueue_head, enqueue_deadline, enqueue_tail</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <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>
... <BR>
... <BR>
if (queue_count == -1)<BR> return
-1;</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> } //
e.o. scope ACE_GUARD_RETURN for queue lock.<BR> this->notify ();
// NO deadlock here, notify will unblock as soon PIPE is
<BR>
// emptied.<BR> return queue_count;<BR>}</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <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> <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 0x009bc5d9 in __lll_mutex_lock_wait () from
/lib/libpthread.so.0<BR>#1 0x009b8636 in _L_mutex_lock_85 () from
/lib/libpthread.so.0<BR>#2 0x009b817d in pthread_mutex_lock () from
/lib/libpthread.so.0<BR>#3 0x00a9f922 in ACE_OS::mutex_lock () from
/usr/lib/libACE.so.5.5.6<BR>#4 0x00fd83c8 in
ACE_Message_Queue<ACE_MT_SYNCH>::is_empty ()<BR> from
/opt/lib/libgcp_datadump.so<BR>#5 0x0142d881 in
can::CCanSvcDriverObserver::handle_output ()<BR> from
/opt/lib/libcanResourceManager.so.2<BR>#6 0x00ac03f6 in
ACE_Select_Reactor_Notify::dispatch_notify ()<BR> from
/usr/lib/libACE.so.5.5.6<BR>#7 0x00ac057a in
ACE_Select_Reactor_Notify::handle_input ()<BR> from
/usr/lib/libACE.so.5.5.6<BR>#8 0x00ac14da in
ACE_Select_Reactor_Notify::dispatch_notifications ()<BR> from
/usr/lib/libACE.so.5.5.6<BR>#9 0x00a5ef8e in
ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task$base ()<BR> from
/usr/lib/libACE.so.5.5.6<BR>#10 0x00a5f5fd in
ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task$base ()<BR> 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> from
/usr/lib/libACE.so.5.5.6<BR>#13 0x0804ae36 in main
()</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><o:p> </o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">[ 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 0x009bc8f1 in write () from /lib/libpthread.so.0<BR>#1
0x00a55a3a in ACE::send () from /usr/lib/libACE.so.5.5.6<BR>#2 0x00ac082e
in ACE_Select_Reactor_Notify::notify ()<BR> from
/usr/lib/libACE.so.5.5.6<BR>#3 0x00a5edcc in
ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task$base ()<BR> from
/usr/lib/libACE.so.5.5.6<BR>#4 0x00abdce6 in ACE_Reactor::notify () from
/usr/lib/libACE.so.5.5.6<BR>#5 0x00abeace in
ACE_Reactor_Notification_Strategy::notify ()<BR> from
/usr/lib/libACE.so.5.5.6<BR>#6 0x0804b42a in
ACE_Message_Queue<ACE_MT_SYNCH>::notify ()<BR>#7 0x00fd7fa2 in
ACE_Message_Queue<ACE_MT_SYNCH>::enqueue_prio ()<BR> from
/opt/lib/libgcp_datadump.so<BR>#8 0x0142d6f3 in
can::CCanSvcDriverObserver::update ()<BR> from
/opt/lib/libcanResourceManager.so.2<BR>#9 0x0143078d in
can::CCanSvcDriver_Base::svc_Read ()<BR> from
/opt/lib/libcanResourceManager.so.2<BR>#10 0x0143087f in
can::CCanSvcDriverRemoteRequestImpl::svc ()<BR> 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> 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> <o:p></o:p></P></DIV>
<DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">[ 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 0x009bc8f1 in write () from /lib/libpthread.so.0<BR>#1
0x00a55a3a in ACE::send () from /usr/lib/libACE.so.5.5.6<BR>#2 0x00ac082e
in ACE_Select_Reactor_Notify::notify ()<BR> from
/usr/lib/libACE.so.5.5.6<BR>#3 0x00a5edcc in
ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task$base ()<BR> from
/usr/lib/libACE.so.5.5.6<BR>#4 0x00abdce6 in ACE_Reactor::notify () from
/usr/lib/libACE.so.5.5.6<BR>#5 0x00abeace in
ACE_Reactor_Notification_Strategy::notify ()<BR> from
/usr/lib/libACE.so.5.5.6<BR>#6 0x0804b42a in
ACE_Message_Queue<ACE_MT_SYNCH>::notify ()<BR>#7 0x00fd7fa2 in
ACE_Message_Queue<ACE_MT_SYNCH>::enqueue_prio ()<BR> from
/opt/lib/libgcp_datadump.so<BR>#8 0x0142d6f3 in
can::CCanSvcDriverObserver::update ()<BR> from
/opt/lib/libcanResourceManager.so.2<BR>#9 0x0143062b in
can::CCanSvcDriver_Base::svc_Read ()<BR> from
/opt/lib/libcanResourceManager.so.2<BR>#10 0x014308cd in
can::CCanSvcDriverReadImpl::svc ()<BR> 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> 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> <o:p></o:p></P></DIV>
<DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">[ 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 0x009bc8f1 in write () from /lib/libpthread.so.0<BR>#1
0x00a55a3a in ACE::send () from /usr/lib/libACE.so.5.5.6<BR>#2 0x00ac082e
in ACE_Select_Reactor_Notify::notify ()<BR> from
/usr/lib/libACE.so.5.5.6<BR>#3 0x00a5edcc in
ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task$base ()<BR> from
/usr/lib/libACE.so.5.5.6<BR>#4 0x00abdce6 in ACE_Reactor::notify () from
/usr/lib/libACE.so.5.5.6<BR>#5 0x00abeace in
ACE_Reactor_Notification_Strategy::notify ()<BR> from
/usr/lib/libACE.so.5.5.6<BR>#6 0x0804b42a in
ACE_Message_Queue<ACE_MT_SYNCH>::notify ()<BR>#7 0x00fd7fa2 in
ACE_Message_Queue<ACE_MT_SYNCH>::enqueue_prio ()<BR> from
/opt/lib/libgcp_datadump.so<BR>#8 0x0142d6f3 in
can::CCanSvcDriverObserver::update ()<BR> from
/opt/lib/libcanResourceManager.so.2<BR>#9 0x0143078d in
can::CCanSvcDriver_Base::svc_Read ()<BR> from
/opt/lib/libcanResourceManager.so.2<BR>#10 0x0143087f in
can::CCanSvcDriverRemoteRequestImpl::svc ()<BR> 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> 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> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><BR><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
REPEAT BY:<BR> See description</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
SAMPLE FIX/WORKAROUND:<BR> Change ACE code so that
<this->notify();> is outside of GUARD scope?<BR>
(like it was before in rev. 46096).</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <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> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <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 to increase the 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, 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> <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> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P>
<DIV>
<P class=MsoNormal><STRONG><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Rudy 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> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><STRONG><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">AWETA G&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
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 +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 </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>