summaryrefslogtreecommitdiff
path: root/docs/tutorials/017/page03.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/tutorials/017/page03.html')
-rw-r--r--docs/tutorials/017/page03.html90
1 files changed, 0 insertions, 90 deletions
diff --git a/docs/tutorials/017/page03.html b/docs/tutorials/017/page03.html
deleted file mode 100644
index 4513ed2260c..00000000000
--- a/docs/tutorials/017/page03.html
+++ /dev/null
@@ -1,90 +0,0 @@
-<HTML>
-<HEAD>
- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
- <META NAME="Author" CONTENT="James CE Johnson">
- <TITLE>ACE Tutorial 017</TITLE>
-</HEAD>
-<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F">
-
-<CENTER><B><FONT SIZE=+2>ACE Tutorial 017</FONT></B></CENTER>
-
-<CENTER><B><FONT SIZE=+2>Using the ACE_Barrier synch object</FONT></B></CENTER>
-
-<P>
-<HR WIDTH="100%">
-The Barrier class used by the test task is a simple wrapper around
-ACE_Barrier. One of the things about ACE_Barrier is that you have to
-tell it how many threads it will be managing. Since that number
-usually isn't known when you create your Task derivative, you have to
-dynamically allocate the ACE_Barrier. My Barrier wrapper takes care
-of that for you and even provides for a clean way to delete the
-ACE_Barrier instance if you want to save a few bytes.
-<P>
-An interesting extension of this Barrier class would be to wrap it up
-in a smart pointer. You could then have the Barrier destructor invoke
-wait() as a now-protected method. The result would allow you to treat
-the Barrier object almost as a "synchronization guard".
-<HR>
-<PRE>
-
-<font color=red>// $Id$</font>
-
-<font color=blue>#ifndef</font> <font color=purple>BARRIER_H</font>
-<font color=blue>#define</font> <font color=purple>BARRIER_H</font>
-
-<font color=blue>#include</font> "<font color=green>ace/Synch.h</font>"
-
-<font color=red>/* Barrier is a simple wrapper for the ACE_Barrier synchronization
- class. The ACE_Barrier is already pretty easy to use but I thought
- I'd wrap it up to create just a bit more abstraction at the
- application level.
- */</font>
-class Barrier
-{
-public:
- <font color=red>// Basic constructor and destructor. If you only need to</font>
- <font color=red>// synch the start of your threads, you can safely delete your </font>
- <font color=red>// Barrier object after invoking done(). Of course, you</font>
- <font color=red>// should be careful to only delete the object once!</font>
- Barrier(void);
- ~Barrier(void);
-
- <font color=red>// Set and get the number of threads that the barrier will</font>
- <font color=red>// manage. If you add or remove threads to your application</font>
- <font color=red>// at run-time you can use the mutator to reflect that</font>
- <font color=red>// change. Note, however, that you can only do that from the</font>
- <font color=red>// thread which first created the Barrier. (This is a</font>
- <font color=red>// limitation of my Barrier object, not the ACE_Barrier.)</font>
- <font color=red>// The optional _wait parameter will cause wait() to be</font>
- <font color=red>// invoked if there is already a valid threads value.</font>
- int threads( u_int _threads, int _wait = 0);
- u_int threads(void);
-
- <font color=red>// Wait for all threads to reach the point where this is</font>
- <font color=red>// invoked. Because of the snappy way in which ACE_Barrier is </font>
- <font color=red>// implemented, you can invoke these back-to-back with no ill-effects.</font>
- int wait(void);
-
- <font color=red>// done() will invoke wait(). Before returning though, it</font>
- <font color=red>// will delete the barrier_ pointer below to reclaim some memory.</font>
- int done(void);
-
-protected:
- <font color=red>// The number of threads we're synching</font>
- ACE_Atomic_Op&lt;ACE_Mutex,u_int> threads_;
-
- <font color=red>// The ACE_Barrier that does all of the work</font>
- ACE_Barrier * barrier_;
-
- <font color=red>// The thread which created the Barrier in the first place.</font>
- <font color=red>// Only this thread can change the threads_ value.</font>
- ACE_thread_t owner_;
-
- <font color=red>// An internal method that constructs the barrier_ as needed.</font>
- int make_barrier( int _wait );
-};
-
-<font color=blue>#endif</font> <font color=red>// BARRIER_H</font>
-</PRE>
-<P><HR WIDTH="100%">
-<CENTER>[<A HREF="..">Tutorial Index</A>] [<A HREF="page04.html">Continue This Tutorial</A>]</CENTER>