summaryrefslogtreecommitdiff
path: root/docs/tutorials/Chap_4/ex01.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/tutorials/Chap_4/ex01.html')
-rw-r--r--docs/tutorials/Chap_4/ex01.html75
1 files changed, 0 insertions, 75 deletions
diff --git a/docs/tutorials/Chap_4/ex01.html b/docs/tutorials/Chap_4/ex01.html
deleted file mode 100644
index 39f479473e8..00000000000
--- a/docs/tutorials/Chap_4/ex01.html
+++ /dev/null
@@ -1,75 +0,0 @@
-<HTML>
-<!-- $Id$ -->
-<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 1</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 1</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>
-<BR>static int number=0;
-<BR>static int seed=0;
-
-<P>static void*
-<BR>worker(void *arg){
-<BR>&nbsp;ACE_UNUSED_ARG(arg);
-<BR>&nbsp;ACE_DEBUG((LM_DEBUG,"Thread (%t) Created to do some work"));
-<BR>&nbsp;::number++;
-<BR>&nbsp;ACE_DEBUG((LM_DEBUG," and number is %d\n",::number));
-<BR>&nbsp;
-<BR>&nbsp;<FONT COLOR="#FF0000">//Let the other guy go while I fall asleep
-for a random period of time</FONT>
-<BR>&nbsp;ACE_Thread::yield();
-<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; "\t\t Thread (%t) Done! \t The number is now: %d\n",number));
-<BR>&nbsp;ACE_OS::fflush(stdout);
-<BR>&nbsp;return 0;
-<BR>&nbsp;}
-<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;
-<BR>int n_threads=ACE_OS::atoi(argv[1]);
-<BR><FONT COLOR="#FF0000">//Setup the random number generator</FONT>
-<BR>ACE_OS::srand(::seed);
-
-<P><FONT COLOR="#FF0000">//Spawn off n_threads number of threads</FONT>
-<BR>for(int i=0; i&lt;n_threads; i++){
-<BR>&nbsp;if(ACE_Thread::spawn((ACE_THR_FUNC)worker)==-1)
-<BR>&nbsp; ACE_DEBUG((LM_DEBUG,"Error in spawning thread\n"));
-<BR>&nbsp;}
-
-<P><FONT COLOR="#FF0000">//Wait for all the threads to exit before you
-let the main fall through</FONT>
-<BR><FONT COLOR="#FF0000">//and have the process exit. This way of using
-join is non-portable</FONT>
-<BR><FONT COLOR="#FF0000">//and may not work on a system using pthreads.</FONT>
-<BR>int check_count=0;
-<BR>while(ACE_Thread::join(NULL,NULL,NULL)==0) check_count++;
-<BR>ACE_ASSERT(check_count==n_threads);
-<BR>}
-
-<P>&nbsp;<A HREF="ex02.html">Next Example</A>
-<BR>&nbsp;
-</BODY>
-</HTML>