summaryrefslogtreecommitdiff
path: root/docs/tutorials/011
diff options
context:
space:
mode:
authorjcej <jcej@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-02-09 21:27:28 +0000
committerjcej <jcej@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-02-09 21:27:28 +0000
commit551a1571610acfcc26a49d191801fa60c61b8e44 (patch)
tree3433f9865b7372ced804ac0d242dfc1fe51c188d /docs/tutorials/011
parent55ed125c54c77746536f982dfd93fd8ce929e39c (diff)
downloadATCD-551a1571610acfcc26a49d191801fa60c61b8e44.tar.gz
*** empty log message ***
Diffstat (limited to 'docs/tutorials/011')
-rw-r--r--docs/tutorials/011/page02.html4
-rw-r--r--docs/tutorials/011/page03.html17
-rw-r--r--docs/tutorials/011/task.cpp13
-rw-r--r--docs/tutorials/011/task.h2
4 files changed, 11 insertions, 25 deletions
diff --git a/docs/tutorials/011/page02.html b/docs/tutorials/011/page02.html
index 714b1927ca3..1e31b4a4694 100644
--- a/docs/tutorials/011/page02.html
+++ b/docs/tutorials/011/page02.html
@@ -27,9 +27,11 @@ the same as before, so I've only commented the changes.
<font color=blue>#include</font> "<font color=green>block.h</font>"
<font color=blue>#include</font> "<font color=green>data.h</font>"
-statuc int
+
+static int
run_test (int iterations,
int threads)
+
{
Task task (threads);
diff --git a/docs/tutorials/011/page03.html b/docs/tutorials/011/page03.html
index 4bbb5d3b62e..fcee526abbd 100644
--- a/docs/tutorials/011/page03.html
+++ b/docs/tutorials/011/page03.html
@@ -49,7 +49,7 @@ public:
int close (u_long flags = 0);
protected:
- ACE_Barrier *barrier_;
+ ACE_Barrier barrier_;
size_t n_threads_;
};
@@ -65,7 +65,7 @@ protected:
<font color=blue>#include</font> "<font color=green>data.h</font>"
<font color=#008888>Task::Task</font> (size_t n_threads)
- : barrier_ (0),
+ : barrier_ (n_threads),
n_threads_ (n_threads)
{
ACE_DEBUG ((LM_DEBUG,
@@ -82,21 +82,14 @@ protected:
ACE_Message_Block *message;
this->getq (message);
message->release ();
-
- delete barrier_;
}
int
<font color=#008888>Task::open</font> (void *)
{
- barrier_;
-
- ACE_NEW_RETURN (barrier_,
- ACE_Barrier (this->n_threads_),
- -1);
-
return this->activate (THR_NEW_LWP,
- threads);
+ this->n_threads_);
+
}
int
@@ -111,7 +104,7 @@ int
int
<font color=#008888>Task::svc</font> (void)
{
- this->barrier_->wait ();
+ this->barrier_.wait ();
ACE_DEBUG ((LM_DEBUG,
"<font color=green>(%P|%t) Task 0x%x starts in thread %d\n</font>",
diff --git a/docs/tutorials/011/task.cpp b/docs/tutorials/011/task.cpp
index 1451aaa0b9a..c0e95d21921 100644
--- a/docs/tutorials/011/task.cpp
+++ b/docs/tutorials/011/task.cpp
@@ -5,7 +5,7 @@
#include "data.h"
Task::Task (size_t n_threads)
- : barrier_ (0),
+ : barrier_ (n_threads),
n_threads_ (n_threads)
{
ACE_DEBUG ((LM_DEBUG,
@@ -22,20 +22,11 @@ Task::~Task (void)
ACE_Message_Block *message;
this->getq (message);
message->release ();
-
- delete barrier_;
}
int
Task::open (void *)
{
-
- barrier_;
-
- ACE_NEW_RETURN (barrier_,
- ACE_Barrier (this->n_threads_),
- -1);
-
return this->activate (THR_NEW_LWP,
this->n_threads_);
@@ -53,7 +44,7 @@ Task::close (u_long flags)
int
Task::svc (void)
{
- this->barrier_->wait ();
+ this->barrier_.wait ();
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) Task 0x%x starts in thread %d\n",
diff --git a/docs/tutorials/011/task.h b/docs/tutorials/011/task.h
index a59f4fda029..c1883bb871a 100644
--- a/docs/tutorials/011/task.h
+++ b/docs/tutorials/011/task.h
@@ -25,7 +25,7 @@ public:
int close (u_long flags = 0);
protected:
- ACE_Barrier *barrier_;
+ ACE_Barrier barrier_;
size_t n_threads_;
};