summaryrefslogtreecommitdiff
path: root/docs/tutorials/Chap_4/ex07.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/tutorials/Chap_4/ex07.html')
-rw-r--r--docs/tutorials/Chap_4/ex07.html84
1 files changed, 0 insertions, 84 deletions
diff --git a/docs/tutorials/Chap_4/ex07.html b/docs/tutorials/Chap_4/ex07.html
deleted file mode 100644
index 4adf56569d3..00000000000
--- a/docs/tutorials/Chap_4/ex07.html
+++ /dev/null
@@ -1,84 +0,0 @@
-<HTML>
-<HEAD>
- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
- <META NAME="Author" CONTENT="Ambreen Ilyas">
- <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (X11; I; SunOS 5.5.1 sun4u) [Netscape]">
- <TITLE>Example 7</TITLE>
-</HEAD>
-<BODY>
-<FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT>
-<BR><FONT COLOR="#CC0000">//// This example is from the ACE Programmers
-Guide.</FONT>
-<BR><FONT COLOR="#CC0000">////&nbsp; Chapter:&nbsp; "Thread Management"</FONT>
-<BR><FONT COLOR="#CC0000">//// For details please see the guide at</FONT>
-<BR><FONT COLOR="#CC0000">//// http://www.cs.wustl.edu/~schmidt/ACE.html</FONT>
-<BR><FONT COLOR="#CC0000">////&nbsp; AUTHOR: Umar Syyid (usyyid@hns.com)</FONT>
-<BR><FONT COLOR="#CC0000">//// and Ambreen Ilyas (ambreen@bitsmart.com)</FONT>
-<BR><FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT>
-
-<P><FONT COLOR="#CC0000">//Example 7</FONT>
-<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/Thread.h"</FONT>
-<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/OS.h"</FONT>
-<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/Synch_T.h"</FONT>
-<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/Synch.h"</FONT>
-
-<P>static int number=0;
-<BR>static int seed=0;
-
-<P>class Args{
-<BR>public:
-<BR>Args(ACE_Barrier *barrier):
-<BR>&nbsp;barrier_(barrier){}
-<BR>ACE_Barrier *barrier_;
-<BR>};
-
-<P>static void*
-<BR>worker(void *arguments){
-<BR>&nbsp;Args *arg= (Args*)arguments;
-<BR>&nbsp;ACE_DEBUG((LM_DEBUG,"Thread (%t) Created to do some work\n"));
-<BR>&nbsp;::number++;
-<BR>&nbsp;
-<BR><FONT COLOR="#FF0000">&nbsp;//Work</FONT>
-<BR>&nbsp;ACE_OS::sleep(ACE_OS::rand()%2);
-
-<P><FONT COLOR="#FF0000">&nbsp;//Exiting now</FONT>
-<BR>&nbsp;ACE_DEBUG((LM_DEBUG,
-<BR>&nbsp;&nbsp;&nbsp; "\tThread (%t) Done! \n\tThe number is now: %d\n",number));
-<BR><FONT COLOR="#FF0000">&nbsp;//Let the barrier know we are done.</FONT>
-<BR>&nbsp;arg->barrier_->wait();
-<BR>&nbsp;ACE_DEBUG((LM_DEBUG,"Thread (%t) is exiting \n"));
-<BR>&nbsp;return 0;
-<BR>}
-<BR>&nbsp;
-
-<P>int main(int argc, char *argv[]){
-<BR>if(argc&lt;2){
-<BR>&nbsp;ACE_DEBUG((LM_DEBUG,"Usage: &lt;program_name> &lt;number of threads>\n"));
-<BR>&nbsp;ACE_OS::exit(1);
-<BR>&nbsp;}
-<BR>&nbsp;
-<BR>int n_threads=ACE_OS::atoi(argv[1]);
-<BR>ACE_DEBUG((LM_DEBUG,"Preparing to spawn %d threads",n_threads));
-<BR><FONT COLOR="#FF0000">//Setup the random number generator</FONT>
-<BR>ACE_OS::srand(::seed);
-
-<P><FONT COLOR="#FF0000">//Setup arguments for threads</FONT>
-<BR>ACE_Barrier barrier(n_threads);
-<BR>Args arg(&amp;barrier);
-
-<P><FONT COLOR="#FF0000">//Spawn off n_threads number of threads</FONT>
-<BR>for(int i=0; i&lt;n_threads; i++){ if(ACE_Thread::spawn((ACE_THR_FUNC)worker,(void*)&amp;arg,THR_DETACHED|THR_NEW_LWP)==-1)
-<BR>&nbsp; ACE_DEBUG((LM_DEBUG,"Error in spawning thread\n"));
-<BR>&nbsp;}
-
-<P><FONT COLOR="#FF0000">//Wait for all the other threads to let the main
-thread</FONT>
-<BR><FONT COLOR="#FF0000">// know that they are done using hte barrier</FONT>
-<BR>barrier.wait();
-<BR>ACE_DEBUG((LM_DEBUG,"(%t)Other threads are finished. Program exiting..\n"));
-<BR>ACE_OS::sleep(2);
-<BR>}
-
-<P>&nbsp;<A HREF="ex08.html">Next Example</A>
-</BODY>
-</HTML>