summaryrefslogtreecommitdiff
path: root/docs/tutorials/010/page06.html
blob: f6d67c3b9698eb0ff249b118b7446c2f5d3a7f90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!-- $Id$ -->
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="Author" CONTENT="James CE Johnson">
   <TITLE>ACE Tutorial 010</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F">

<CENTER><B><FONT SIZE=+2>ACE Tutorial 010</FONT></B></CENTER>

<CENTER><B><FONT SIZE=+2>Passing chunks of data through an ACE_Message_Queue</FONT></B></CENTER>


<P>
<HR WIDTH="100%">

Since I added Block just to give us output, let's take a look at that output.

<P>
<HR WIDTH="100%">
<PRE>
[jcej@chiroptera 010]$./message_queue 4 2
(8910|1024) Task ctor 0xbffff9c4
(8910|2050) Task 0xbffff9c4 starts in thread 2050
(8910|1025) Task 0xbffff9c4 starts in thread 1025
(8910|1024) Block ctor 0x8052398
(8910|1024) Block ctor 0x8052488
(8910|1024) Block ctor 0x8052578
(8910|1024) Block ctor 0x8052668
(8910|1024) Block ctor 0x8052758
(8910|1025) Block 0x8052398 contains (This is message 0.)
(8910|2050) Block 0x8052488 contains (This is message 1.)
(8910|1025) Block dtor 0x8052398
(8910|1025) Block 0x8052578 contains (This is message 2.)
(8910|2050) Block dtor 0x8052488
(8910|2050) Block 0x8052668 contains (This is message 3.)
(8910|1025) Block dtor 0x8052578
(8910|1025) Task close 0xbffff9c4
(8910|2050) Block dtor 0x8052668
(8910|2050) Task close 0xbffff9c4
(8910|1024) Task dtor 0xbffff9c4
(8910|1024) Block dtor 0x8052758
(8910|1024) Application exiting
[jcej@chiroptera 010]$
</PRE>
<HR WIDTH="100%">
<P>
Notice that each <i>Block ctor</i> has a corresponding <i>Block dtor</i>.
We've proven the point that all memory gets cleaned up.  We also see that
both threads get to do some work and that both close as expected.
<P>
It's also worth mentioning that it's just an accident that all of the blocks
are created and enqueued before any are processed.  Run the test on a multi-processor
or with more iterations and you'll see some get processed before all are created.
<P><HR WIDTH="100%">
<CENTER>[<A HREF="../online-tutorials.html">Tutorial Index</A>] [<A HREF="page07.html">Continue This Tutorial</A>]</CENTER>