summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjcej <jcej@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-31 16:57:11 +0000
committerjcej <jcej@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-31 16:57:11 +0000
commitea604c0714a46eef1f159c31f17c3367147bcf22 (patch)
tree88c57b0e9ef579128c4e88b5bd7550a6f303bc98
parent67f212c9a6ca8293fd03ba5f208c52679b7dc542 (diff)
downloadATCD-ea604c0714a46eef1f159c31f17c3367147bcf22.tar.gz
*** empty log message ***
-rw-r--r--ChangeLog-99b19
-rw-r--r--docs/tutorials/010/message_queue.cpp7
-rw-r--r--docs/tutorials/010/page01.html3
-rw-r--r--docs/tutorials/010/page02.html7
-rw-r--r--docs/tutorials/010/page03.html3
-rw-r--r--docs/tutorials/010/page04.html12
-rw-r--r--docs/tutorials/010/page05.html11
-rw-r--r--docs/tutorials/010/task.cpp11
-rw-r--r--docs/tutorials/010/task.h12
-rw-r--r--docs/tutorials/011/message_queue.cpp4
-rw-r--r--docs/tutorials/011/page02.html4
-rw-r--r--docs/tutorials/011/page03.html4
-rw-r--r--docs/tutorials/011/task.cpp2
-rw-r--r--docs/tutorials/011/task.h2
-rw-r--r--docs/tutorials/012/message_queue.cpp4
-rw-r--r--docs/tutorials/012/page04.html4
-rw-r--r--docs/tutorials/012/page05.html17
-rw-r--r--docs/tutorials/012/task.cpp2
-rw-r--r--docs/tutorials/012/task.h15
-rw-r--r--docs/tutorials/013/combine.shar47
-rw-r--r--docs/tutorials/013/message_queue.cpp4
-rw-r--r--docs/tutorials/013/page01.html31
-rw-r--r--docs/tutorials/013/page02.html6
-rw-r--r--docs/tutorials/013/page03.html4
-rw-r--r--docs/tutorials/013/page06.html16
-rw-r--r--docs/tutorials/013/page07.html4
-rw-r--r--docs/tutorials/013/task.cpp4
-rw-r--r--docs/tutorials/013/task.h8
-rw-r--r--docs/tutorials/017/Barrier_i.cpp2
-rw-r--r--docs/tutorials/017/Makefile2
-rw-r--r--docs/tutorials/017/page02.html3
-rw-r--r--docs/tutorials/017/page04.html2
32 files changed, 183 insertions, 93 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b
index 7f045b05c9a..6528206ccaf 100644
--- a/ChangeLog-99b
+++ b/ChangeLog-99b
@@ -1,3 +1,22 @@
+
+Sun Jan 31 11:58:32 1999 James CE Johnson <jcej@chiroptera.tragus.org>
+
+ * docs/tutorials/{010|011|012|013|017}:
+ In all of these, I'd overridden open() as open(int) to specify
+ the number of threads in a thread-pool. Steve Huston pointed
+ out that this causes grief with some compilers. I've changed
+ all of these open(int) overrides to start(int) instead.
+
+ * docs/tutorials/017/Barrier_i.cpp (threads):
+ The thr_equal() call was changed to !thr_equal().
+
+ * docs/tutorials/010/taks.cpp:
+ Vishal recommended some extra commentation to make things a bit
+ more clear WRT barrier synch.
+
+ * docs/tutorials/013/page01.html:
+ Added Kirthika's abstract.
+
Sat Jan 30 16:03:23 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
* websvcs/lib/URL_Addr.h:
diff --git a/docs/tutorials/010/message_queue.cpp b/docs/tutorials/010/message_queue.cpp
index 98a9019024c..a446bfa3706 100644
--- a/docs/tutorials/010/message_queue.cpp
+++ b/docs/tutorials/010/message_queue.cpp
@@ -11,14 +11,13 @@
int run_test( int iterations, int threads )
{
/*
- Create and open an instance of our Task object. I've overridden the
- open() method to make it look more like other ACE objects.
+ Create and star an instance of our Task object.
*/
Task task;
- if (task.open (threads) == -1)
+ if (task.start (threads) == -1)
{
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "start"), -1);
}
/*
diff --git a/docs/tutorials/010/page01.html b/docs/tutorials/010/page01.html
index d1ce107b6e2..8e27323bd1a 100644
--- a/docs/tutorials/010/page01.html
+++ b/docs/tutorials/010/page01.html
@@ -55,5 +55,6 @@ releasing it.
This simple tutorial makes us aware of the usage and importance of the
Message Queue which could be used to our advantage especially for
multithreaded applications.
-</UL><P><HR WIDTH="100%">
+</UL>
+<P><HR WIDTH="100%">
<CENTER>[<A HREF="../online-tutorials.html">Tutorial Index</A>] [<A HREF="page02.html">Continue This Tutorial</A>]</CENTER>
diff --git a/docs/tutorials/010/page02.html b/docs/tutorials/010/page02.html
index 75d7b9984ba..342f71e5e4c 100644
--- a/docs/tutorials/010/page02.html
+++ b/docs/tutorials/010/page02.html
@@ -32,14 +32,13 @@ We'll look first at <A HREF="message_queue.cpp">main()</A>.
int run_test( int iterations, int threads )
{
<font color=red>/*
- Create and open an instance of our Task object. I've overridden the
- open() method to make it look more like other ACE objects.
+ Create and star an instance of our Task object.
*/</font>
Task task;
- if (task.open (threads) == -1)
+ if (task.start (threads) == -1)
{
- ACE_ERROR_RETURN ((LM_ERROR, "<font color=green>%p\n</font>", "<font color=green>open</font>"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR, "<font color=green>%p\n</font>", "<font color=green>start</font>"), -1);
}
<font color=red>/*
diff --git a/docs/tutorials/010/page03.html b/docs/tutorials/010/page03.html
index b0c618ef8be..20710ff1c92 100644
--- a/docs/tutorials/010/page03.html
+++ b/docs/tutorials/010/page03.html
@@ -64,5 +64,6 @@ public:
Ok, nothing really magic there. Some folks just feel a little uncomfortable
not doing an explicit <i>delete</i> on objects they've <i>new</i>'d so I
wanted to show you that the memory really does get cleaned up.
- <P><HR WIDTH="100%">
+
+<P><HR WIDTH="100%">
<CENTER>[<A HREF="../online-tutorials.html">Tutorial Index</A>] [<A HREF="page04.html">Continue This Tutorial</A>]</CENTER>
diff --git a/docs/tutorials/010/page04.html b/docs/tutorials/010/page04.html
index c4d7c5706c7..fb6b5cf67f3 100644
--- a/docs/tutorials/010/page04.html
+++ b/docs/tutorials/010/page04.html
@@ -50,12 +50,12 @@ public:
Task (void);
~Task (void);
- <font color=red>/*
- To make our Task&lt;> derivative look more like other ACE objects
- I've added an open() method. It will take care of activate()ing
- the object.
- */</font>
- int open (int threads = 1);
+ <font color=red>/*
+ I really wanted this to be called open() but that was already
+ claimed by the Task framework. start() will kick off our thread
+ pool for us.
+ */</font>
+ int start (int threads = 1);
<font color=red>/*
Our worker method
diff --git a/docs/tutorials/010/page05.html b/docs/tutorials/010/page05.html
index ea55a7b1847..238bfab2b6a 100644
--- a/docs/tutorials/010/page05.html
+++ b/docs/tutorials/010/page05.html
@@ -45,6 +45,12 @@ Our <A HREF="task.cpp">Task</A> object definition:
Get our shutdown notification out of the queue and release it.
*/</font>
ACE_Message_Block * message;
+
+ <font color=red>/*
+ Like the getq() in svc() below, this will block until a message
+ arrives. By blocking, we know that the destruction will be paused
+ until the last thread is done with the message block.
+ */</font>
this->getq(message);
message->release();
@@ -56,7 +62,7 @@ Our <A HREF="task.cpp">Task</A> object definition:
it how many threads we'll be using. Next, we activate the Task
into the number of requested threads.
*/</font>
-int <font color=#008888>Task::open</font> (int threads)
+int <font color=#008888>Task::start</font> (int threads)
{
barrier_ = new ACE_Barrier (threads);
return this->activate (THR_NEW_LWP, threads);
@@ -97,7 +103,8 @@ int <font color=#008888>Task::svc</font> (void)
while (1)
{
<font color=red>/*
- Get a message from the queue.
+ Get a message from the queue. Note that getq() will block until
+ a message shows up. That makes us very processor-friendly.
*/</font>
if (this->getq (message) == -1)
{
diff --git a/docs/tutorials/010/task.cpp b/docs/tutorials/010/task.cpp
index 84f70cae0ee..4311474dceb 100644
--- a/docs/tutorials/010/task.cpp
+++ b/docs/tutorials/010/task.cpp
@@ -24,6 +24,12 @@ Task::~Task (void)
Get our shutdown notification out of the queue and release it.
*/
ACE_Message_Block * message;
+
+ /*
+ Like the getq() in svc() below, this will block until a message
+ arrives. By blocking, we know that the destruction will be paused
+ until the last thread is done with the message block.
+ */
this->getq(message);
message->release();
@@ -35,7 +41,7 @@ Task::~Task (void)
it how many threads we'll be using. Next, we activate the Task
into the number of requested threads.
*/
-int Task::open (int threads)
+int Task::start (int threads)
{
barrier_ = new ACE_Barrier (threads);
return this->activate (THR_NEW_LWP, threads);
@@ -76,7 +82,8 @@ int Task::svc (void)
while (1)
{
/*
- Get a message from the queue.
+ Get a message from the queue. Note that getq() will block until
+ a message shows up. That makes us very processor-friendly.
*/
if (this->getq (message) == -1)
{
diff --git a/docs/tutorials/010/task.h b/docs/tutorials/010/task.h
index 2aecb429c03..9351959d6b1 100644
--- a/docs/tutorials/010/task.h
+++ b/docs/tutorials/010/task.h
@@ -29,12 +29,12 @@ public:
Task (void);
~Task (void);
- /*
- To make our Task<> derivative look more like other ACE objects
- I've added an open() method. It will take care of activate()ing
- the object.
- */
- int open (int threads = 1);
+ /*
+ I really wanted this to be called open() but that was already
+ claimed by the Task framework. start() will kick off our thread
+ pool for us.
+ */
+ int start (int threads = 1);
/*
Our worker method
diff --git a/docs/tutorials/011/message_queue.cpp b/docs/tutorials/011/message_queue.cpp
index fdb6c57bd24..e591f18f024 100644
--- a/docs/tutorials/011/message_queue.cpp
+++ b/docs/tutorials/011/message_queue.cpp
@@ -13,9 +13,9 @@ int run_test (int iterations, int threads)
{
Task task;
- if (task.open (threads) == -1)
+ if (task.start (threads) == -1)
{
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "start"), -1);
}
ACE_OS::sleep (ACE_Time_Value (1));
diff --git a/docs/tutorials/011/page02.html b/docs/tutorials/011/page02.html
index 1302cf7149d..df8e77e977b 100644
--- a/docs/tutorials/011/page02.html
+++ b/docs/tutorials/011/page02.html
@@ -34,9 +34,9 @@ int run_test (int iterations, int threads)
{
Task task;
- if (task.open (threads) == -1)
+ if (task.start (threads) == -1)
{
- ACE_ERROR_RETURN ((LM_ERROR, "<font color=green>%p\n</font>", "<font color=green>open</font>"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR, "<font color=green>%p\n</font>", "<font color=green>start</font>"), -1);
}
<font color=#008888>ACE_OS::sleep</font> (ACE_Time_Value (1));
diff --git a/docs/tutorials/011/page03.html b/docs/tutorials/011/page03.html
index 515b50763e4..bff7cd1f319 100644
--- a/docs/tutorials/011/page03.html
+++ b/docs/tutorials/011/page03.html
@@ -43,7 +43,7 @@ public:
Task (void);
~Task (void);
- int open (int threads = 1);
+ int start (int threads = 1);
int svc (void);
@@ -81,7 +81,7 @@ protected:
delete barrier_;
}
-int <font color=#008888>Task::open</font> (int threads)
+int <font color=#008888>Task::start</font> (int threads)
{
barrier_ = new ACE_Barrier (threads);
return this->activate (THR_NEW_LWP, threads);
diff --git a/docs/tutorials/011/task.cpp b/docs/tutorials/011/task.cpp
index a7215191481..3a5e4393317 100644
--- a/docs/tutorials/011/task.cpp
+++ b/docs/tutorials/011/task.cpp
@@ -22,7 +22,7 @@ Task::~Task (void)
delete barrier_;
}
-int Task::open (int threads)
+int Task::start (int threads)
{
barrier_ = new ACE_Barrier (threads);
return this->activate (THR_NEW_LWP, threads);
diff --git a/docs/tutorials/011/task.h b/docs/tutorials/011/task.h
index 8646fac1a7c..255513ecd6f 100644
--- a/docs/tutorials/011/task.h
+++ b/docs/tutorials/011/task.h
@@ -19,7 +19,7 @@ public:
Task (void);
~Task (void);
- int open (int threads = 1);
+ int start (int threads = 1);
int svc (void);
diff --git a/docs/tutorials/012/message_queue.cpp b/docs/tutorials/012/message_queue.cpp
index 53870076378..c8c1f60ed11 100644
--- a/docs/tutorials/012/message_queue.cpp
+++ b/docs/tutorials/012/message_queue.cpp
@@ -17,9 +17,9 @@ int run_test (int iterations, int threads)
*/
Task task;
- if (task.open (threads) == -1)
+ if (task.start (threads) == -1)
{
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "start"), -1);
}
/*
diff --git a/docs/tutorials/012/page04.html b/docs/tutorials/012/page04.html
index bd503680338..75d8455f848 100644
--- a/docs/tutorials/012/page04.html
+++ b/docs/tutorials/012/page04.html
@@ -38,9 +38,9 @@ int run_test (int iterations, int threads)
*/</font>
Task task;
- if (task.open (threads) == -1)
+ if (task.start (threads) == -1)
{
- ACE_ERROR_RETURN ((LM_ERROR, "<font color=green>%p\n</font>", "<font color=green>open</font>"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR, "<font color=green>%p\n</font>", "<font color=green>start</font>"), -1);
}
<font color=red>/*
diff --git a/docs/tutorials/012/page05.html b/docs/tutorials/012/page05.html
index 7507452dac4..7e5be17d446 100644
--- a/docs/tutorials/012/page05.html
+++ b/docs/tutorials/012/page05.html
@@ -52,15 +52,12 @@ public:
Task (void);
~Task (void);
- <font color=red>// Some compilers complain when we don't overload all</font>
- <font color=red>// baseclass signatures of a method. &lt;sigh></font>
- virtual int open ( void * args )
- {
- return -1;
- }
-
- <font color=red>// This is the open() we really want our clients to use.</font>
- int open (int threads = 1);
+ <font color=red>/*
+ I really wanted this to be called open() but that was already
+ claimed by the Task framework. start() will kick off our thread
+ pool for us.
+ */</font>
+ int start (int threads = 1);
virtual int svc (void);
@@ -118,7 +115,7 @@ protected:
get here. We then pass the thread count through to our base class'
activate().
*/</font>
-int <font color=#008888>Task::open</font> (int threads)
+int <font color=#008888>Task::start</font> (int threads)
{
barrier_ = new ACE_Barrier (threads);
return this->activate (THR_NEW_LWP, threads);
diff --git a/docs/tutorials/012/task.cpp b/docs/tutorials/012/task.cpp
index 06231e309b0..aea14e86a25 100644
--- a/docs/tutorials/012/task.cpp
+++ b/docs/tutorials/012/task.cpp
@@ -42,7 +42,7 @@ Task::~Task (void)
get here. We then pass the thread count through to our base class'
activate().
*/
-int Task::open (int threads)
+int Task::start (int threads)
{
barrier_ = new ACE_Barrier (threads);
return this->activate (THR_NEW_LWP, threads);
diff --git a/docs/tutorials/012/task.h b/docs/tutorials/012/task.h
index 2fea3f7fdab..bd2c20fda3c 100644
--- a/docs/tutorials/012/task.h
+++ b/docs/tutorials/012/task.h
@@ -29,15 +29,12 @@ public:
Task (void);
~Task (void);
- // Some compilers complain when we don't overload all
- // baseclass signatures of a method. <sigh>
- virtual int open ( void * args )
- {
- return -1;
- }
-
- // This is the open() we really want our clients to use.
- int open (int threads = 1);
+ /*
+ I really wanted this to be called open() but that was already
+ claimed by the Task framework. start() will kick off our thread
+ pool for us.
+ */
+ int start (int threads = 1);
virtual int svc (void);
diff --git a/docs/tutorials/013/combine.shar b/docs/tutorials/013/combine.shar
index e67be9253c5..feedd51e0a8 100644
--- a/docs/tutorials/013/combine.shar
+++ b/docs/tutorials/013/combine.shar
@@ -3,7 +3,7 @@
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
-# Made on 1998-11-15 12:09 EST by <jcej@chiroptera.tragus.org>.
+# Made on 1999-01-31 11:54 EST by <jcej@chiroptera.tragus.org>.
# Source directory was `/var/home/jcej/projects/ACE_wrappers/docs/tutorials/013'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
@@ -13,7 +13,7 @@
# ------ ---------- ------------------------------------------
# 386 -rw-rw-r-- hdr
# 89 -rw-rw-r-- bodies
-# 976 -rw-rw-r-- page01.pre
+# 2415 -rw-rw-r-- page01.pre
# 432 -rw-rw-r-- page02.pre
# 1426 -rw-rw-r-- page03.pre
# 1049 -rw-rw-r-- page04.pre
@@ -71,7 +71,7 @@ else
fi
rm -f 1231235999 $$.touch
#
-if mkdir _sh10945; then
+if mkdir _sh30349; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
@@ -145,8 +145,6 @@ if test -f 'page01.pre' && test "$first_param" != -c; then
else
$echo 'x -' extracting 'page01.pre' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'page01.pre' &&
-X
-X
<P>
<HR WIDTH="100%">
<P>
@@ -168,20 +166,49 @@ method is called for finishing up any outstanding work.
The chain of thread pools is uni-directional using a singly-linked
list of Task derivatives. Each pool has the same number of tasks in
order to keep things simple.
+<P>
+Kirthika's abstract:
+<UL>
+In this tutorial, a singly linked list of thread-pools, each of which is
+a subtask and which acts as the finite state machine node, is used to
+simulate a finite state machine.
+<P>
+A task is created with a number of subtasks. Once the message block is
+obtained from the queue, it is verified to see whether a task has a
+subtask. If so, it is forwarded to the subtask. Thus the mesage
+traverses over the whole list. As a safety measure for destroying the
+block after it goes through the whole list, an effective and simple
+Memory Leak Detector has been implemented. It is a counter which
+increments when the object where it resides is created and decrements on
+its deletion.
+<P>
+Another optimisation from the previous tutorials on Message Queues, is
+the bundling of the Data block within the Message Block. The Data block
+provides reference counting, so duplication of data is avoided. It is
+deleted only when its reference count drops to zero. Now updating
+this count between threads call for synchronisation and in comes the
+ACE_Mutex, a lock which takes care that the counting is thread-safe.
+<P>
+Although the example isn't a full-fledged Finite State Machine,
+i.e. it has to be tweaked to be able to jump states on different inputs,
+it definitely proves to be a great lesson and introduces us to quite a
+few new ACE classes and the ways they can be mixed and matched to
+produce the end-system desired.
+</ul>
SHAR_EOF
- $shar_touch -am 1114225598 'page01.pre' &&
+ $shar_touch -am 0131114799 'page01.pre' &&
chmod 0664 'page01.pre' ||
$echo 'restore of' 'page01.pre' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'page01.pre:' 'MD5 check failed'
-391c8a4163bf85a87526b476ac9f0f99 page01.pre
+52884c61973afc64e96c907493ebc216 page01.pre
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'page01.pre'`"
- test 976 -eq "$shar_count" ||
- $echo 'page01.pre:' 'original size' '976,' 'current size' "$shar_count!"
+ test 2415 -eq "$shar_count" ||
+ $echo 'page01.pre:' 'original size' '2415,' 'current size' "$shar_count!"
fi
fi
# ============= page02.pre ==============
@@ -630,5 +657,5 @@ SHAR_EOF
$echo 'page07.pst:' 'original size' '371,' 'current size' "$shar_count!"
fi
fi
-rm -fr _sh10945
+rm -fr _sh30349
exit 0
diff --git a/docs/tutorials/013/message_queue.cpp b/docs/tutorials/013/message_queue.cpp
index 5238bd00ccb..4635304a460 100644
--- a/docs/tutorials/013/message_queue.cpp
+++ b/docs/tutorials/013/message_queue.cpp
@@ -14,9 +14,9 @@ int run_test (int iterations, int threads, int subtasks)
// task.{h|cpp} for more details.
Task *task = new Task (subtasks);
- if (task->open (threads) == -1)
+ if (task->start (threads) == -1)
{
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "start"), -1);
}
// Give the threads a chance to get ready.
diff --git a/docs/tutorials/013/page01.html b/docs/tutorials/013/page01.html
index 251a053aadc..f222eb01202 100644
--- a/docs/tutorials/013/page01.html
+++ b/docs/tutorials/013/page01.html
@@ -9,8 +9,6 @@
<CENTER><B><FONT SIZE=+2>ACE Tutorial 013</FONT></B></CENTER>
<CENTER><B><FONT SIZE=+2>Multiple thread pools</FONT></B></CENTER>
-
-
<P>
<HR WIDTH="100%">
<P>
@@ -32,5 +30,34 @@ method is called for finishing up any outstanding work.
The chain of thread pools is uni-directional using a singly-linked
list of Task derivatives. Each pool has the same number of tasks in
order to keep things simple.
+<P>
+Kirthika's abstract:
+<UL>
+In this tutorial, a singly linked list of thread-pools, each of which is
+a subtask and which acts as the finite state machine node, is used to
+simulate a finite state machine.
+<P>
+A task is created with a number of subtasks. Once the message block is
+obtained from the queue, it is verified to see whether a task has a
+subtask. If so, it is forwarded to the subtask. Thus the mesage
+traverses over the whole list. As a safety measure for destroying the
+block after it goes through the whole list, an effective and simple
+Memory Leak Detector has been implemented. It is a counter which
+increments when the object where it resides is created and decrements on
+its deletion.
+<P>
+Another optimisation from the previous tutorials on Message Queues, is
+the bundling of the Data block within the Message Block. The Data block
+provides reference counting, so duplication of data is avoided. It is
+deleted only when its reference count drops to zero. Now updating
+this count between threads call for synchronisation and in comes the
+ACE_Mutex, a lock which takes care that the counting is thread-safe.
+<P>
+Although the example isn't a full-fledged Finite State Machine,
+i.e. it has to be tweaked to be able to jump states on different inputs,
+it definitely proves to be a great lesson and introduces us to quite a
+few new ACE classes and the ways they can be mixed and matched to
+produce the end-system desired.
+</ul>
<P><HR WIDTH="100%">
<CENTER>[<A HREF="../online-tutorials.html">Tutorial Index</A>] [<A HREF="page02.html">Continue This Tutorial</A>]</CENTER>
diff --git a/docs/tutorials/013/page02.html b/docs/tutorials/013/page02.html
index 7fca9f39265..85475ae7709 100644
--- a/docs/tutorials/013/page02.html
+++ b/docs/tutorials/013/page02.html
@@ -39,9 +39,9 @@ int run_test (int iterations, int threads, int subtasks)
<font color=red>// task.{h|cpp} for more details.</font>
Task *task = new Task (subtasks);
- if (task->open (threads) == -1)
+ if (task->start (threads) == -1)
{
- ACE_ERROR_RETURN ((LM_ERROR, "<font color=green>%p\n</font>", "<font color=green>open</font>"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR, "<font color=green>%p\n</font>", "<font color=green>start</font>"), -1);
}
<font color=red>// Give the threads a chance to get ready.</font>
@@ -98,7 +98,7 @@ int main (int argc, char *argv[])
ACE_DEBUG ((LM_DEBUG, "<font color=green>(%P|%t) Application exiting\n</font>"));
- exit (0);
+ return (0);
}
<font color=blue>#if defined</font> (<font color=purple>ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION</font>)
template class ACE_Guard &lt; ACE_Mutex >;
diff --git a/docs/tutorials/013/page03.html b/docs/tutorials/013/page03.html
index 43a2d0832ca..3bb955c2b29 100644
--- a/docs/tutorials/013/page03.html
+++ b/docs/tutorials/013/page03.html
@@ -42,8 +42,8 @@ or I deleted too many times.
Simple, cheap, effective.
<P>
<HR WIDTH="100%">
-<PRE>
<HR width=50%><P><center>mld.h</center><HR width=50%>
+<PRE>
<font color=red>// $Id$</font>
@@ -94,8 +94,8 @@ protected:
<font color=blue>#endif</font>
</PRE>
-<PRE>
<HR width=50%><P><center>mld.cpp</center><HR width=50%>
+<PRE>
<font color=red>// $Id$</font>
diff --git a/docs/tutorials/013/page06.html b/docs/tutorials/013/page06.html
index 66a71581c70..14d1cbb8402 100644
--- a/docs/tutorials/013/page06.html
+++ b/docs/tutorials/013/page06.html
@@ -33,8 +33,8 @@ There's not much to the header, so I've included it and the cpp file
on this one page.
<P>
<HR WIDTH="100%">
-<PRE>
<HR width=50%><P><center>task.h</center><HR width=50%>
+<PRE>
<font color=red>// $Id$</font>
@@ -68,8 +68,12 @@ public:
Task (int sub_tasks = 0);
~Task (void);
- <font color=red>// Open the Task with the proper thread-pool size</font>
- int open (int threads = 1);
+ <font color=red>/*
+ I really wanted this to be called open() but that was already
+ claimed by the Task framework. start() will kick off our thread
+ pool for us.
+ */</font>
+ int start (int threads = 1);
<font color=red>// Take Unit_Of_Work objects from the thread pool and invoke</font>
<font color=red>// their process() and/or fini() as appropriate.</font>
@@ -89,8 +93,8 @@ protected:
<font color=blue>#endif</font>
</PRE>
-<PRE>
<HR width=50%><P><center>task.cpp</center><HR width=50%>
+<PRE>
<font color=red>// $Id$</font>
@@ -130,11 +134,11 @@ protected:
enabled, they inherit the thread-pool size. Make sure that the subtasks can
be opened before we open our own threadpool.
*/</font>
-int <font color=#008888>Task::open</font> (int threads)
+int <font color=#008888>Task::start</font> (int threads)
{
if (next_)
{
- if (next_->open (threads) == -1)
+ if (next_->start (threads) == -1)
{
return -1;
}
diff --git a/docs/tutorials/013/page07.html b/docs/tutorials/013/page07.html
index 415521d09e3..983878e676a 100644
--- a/docs/tutorials/013/page07.html
+++ b/docs/tutorials/013/page07.html
@@ -40,8 +40,8 @@ There's not much to this header either so I've combined it with the
cpp file as with task.
<P>
<HR WIDTH="100%">
-<PRE>
<HR width=50%><P><center>work.h</center><HR width=50%>
+<PRE>
<font color=red>// $Id$</font>
@@ -115,8 +115,8 @@ protected:
<font color=blue>#endif</font>
</PRE>
-<PRE>
<HR width=50%><P><center>work.cpp</center><HR width=50%>
+<PRE>
<font color=red>// $Id$</font>
diff --git a/docs/tutorials/013/task.cpp b/docs/tutorials/013/task.cpp
index 6d6bf88b8cc..75c0a0d3341 100644
--- a/docs/tutorials/013/task.cpp
+++ b/docs/tutorials/013/task.cpp
@@ -37,11 +37,11 @@ Task::~Task (void)
enabled, they inherit the thread-pool size. Make sure that the subtasks can
be opened before we open our own threadpool.
*/
-int Task::open (int threads)
+int Task::start (int threads)
{
if (next_)
{
- if (next_->open (threads) == -1)
+ if (next_->start (threads) == -1)
{
return -1;
}
diff --git a/docs/tutorials/013/task.h b/docs/tutorials/013/task.h
index ced1ad15cf9..64f4064dfa0 100644
--- a/docs/tutorials/013/task.h
+++ b/docs/tutorials/013/task.h
@@ -31,8 +31,12 @@ public:
Task (int sub_tasks = 0);
~Task (void);
- // Open the Task with the proper thread-pool size
- int open (int threads = 1);
+ /*
+ I really wanted this to be called open() but that was already
+ claimed by the Task framework. start() will kick off our thread
+ pool for us.
+ */
+ int start (int threads = 1);
// Take Unit_Of_Work objects from the thread pool and invoke
// their process() and/or fini() as appropriate.
diff --git a/docs/tutorials/017/Barrier_i.cpp b/docs/tutorials/017/Barrier_i.cpp
index b170221fcf4..308b44cc397 100644
--- a/docs/tutorials/017/Barrier_i.cpp
+++ b/docs/tutorials/017/Barrier_i.cpp
@@ -44,7 +44,7 @@ u_int Barrier::threads(void)
*/
int Barrier::threads( u_int _threads, int _wait )
{
- if( ACE_OS::thr_equal(ACE_OS::thr_self(), owner_) )
+ if( ! ACE_OS::thr_equal(ACE_OS::thr_self(), owner_) )
{
return -1;
}
diff --git a/docs/tutorials/017/Makefile b/docs/tutorials/017/Makefile
index 5703100210c..0830f114d68 100644
--- a/docs/tutorials/017/Makefile
+++ b/docs/tutorials/017/Makefile
@@ -51,7 +51,7 @@ Indent : #
done
Depend : depend
- perl ../fix.Makefile
+ perl ../007/fix.Makefile
.depend : #
touch .depend
diff --git a/docs/tutorials/017/page02.html b/docs/tutorials/017/page02.html
index 63617a76a8c..5b7417bc4a9 100644
--- a/docs/tutorials/017/page02.html
+++ b/docs/tutorials/017/page02.html
@@ -71,7 +71,8 @@ int <font color=#008888>Test::svc</font>(void)
<font color=red>// Initialize the random number generator. We'll use this to</font>
<font color=red>// create sleep() times in each thread. This will help us see </font>
<font color=red>// if the barrier synch is working.</font>
- ACE_RANDR_TYPE seed = <font color=#008888>ACE_OS::thr_self</font>();
+ ACE_Time_Value now(<font color=#008888>ACE_OS::gettimeofday</font>());
+ ACE_RANDR_TYPE seed = now.usec();
<font color=#008888>ACE_OS::srand</font>(seed);
int delay;
diff --git a/docs/tutorials/017/page04.html b/docs/tutorials/017/page04.html
index aced1b67217..7032f4c2d3a 100644
--- a/docs/tutorials/017/page04.html
+++ b/docs/tutorials/017/page04.html
@@ -67,7 +67,7 @@ u_int <font color=#008888>Barrier::threads</font>(void)
*/</font>
int <font color=#008888>Barrier::threads</font>( u_int _threads, int _wait )
{
- if( <font color=#008888>ACE_OS::thr_self</font>() != owner_ )
+ if( ! <font color=#008888>ACE_OS::thr_equal</font>(ACE_OS::thr_self(), owner_) )
{
return -1;
}