diff options
Diffstat (limited to 'docs/tutorials/Chap_4/ex08.html')
-rw-r--r-- | docs/tutorials/Chap_4/ex08.html | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/docs/tutorials/Chap_4/ex08.html b/docs/tutorials/Chap_4/ex08.html deleted file mode 100644 index 2418a93c0a8..00000000000 --- a/docs/tutorials/Chap_4/ex08.html +++ /dev/null @@ -1,72 +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 8</TITLE> -</HEAD> -<BODY> -<FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> -<BR><FONT COLOR="#CC0000">//// This example is from the ACE Programmers -Guide.</FONT> -<BR><FONT COLOR="#CC0000">//// Chapter: "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">//// 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 8</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>ACE_Atomic_Op<ACE_Thread_Mutex,int> foo; - -<P>static void* -<BR>worker(void *arg){ -<BR> ACE_UNUSED_ARG(arg); -<BR> foo=5; -<BR> ACE_ASSERT (foo == 5); -<BR> -<BR> ++foo; -<BR> ACE_ASSERT (foo == 6); -<BR> -<BR> --foo; -<BR> ACE_ASSERT (foo == 5); -<BR> -<BR> foo += 10; -<BR> ACE_ASSERT (foo == 15); -<BR> -<BR> foo -= 10; -<BR> ACE_ASSERT (foo == 5); -<BR> -<BR> foo = 5L; -<BR> ACE_ASSERT (foo == 5); -<BR> return 0; -<BR>} - -<P>int main(int argc, char *argv[]){ -<BR>if(argc<2){ -<BR> ACE_DEBUG((LM_DEBUG,"Usage: <program_name> <number of threads>\n")); -<BR> ACE_OS::exit(1); -<BR> } -<BR> -<BR>int n_threads=ACE_OS::atoi(argv[1]); -<BR>ACE_DEBUG((LM_DEBUG,"Preparing to spawn %d threads\n",n_threads)); -<BR> - -<P><FONT COLOR="#FF0000">//Spawn off n_threads number of threads</FONT> -<BR>for(int i=0; i<n_threads; i++){ -<BR> if(ACE_Thread::spawn((ACE_THR_FUNC)worker,0,THR_DETACHED|THR_NEW_LWP)==-1) -<BR> ACE_DEBUG((LM_DEBUG,"Error in spawning thread\n")); -<BR> } - -<P><FONT COLOR="#FF0000">//Wait for all the other threads to let the main -thread know when it is time to exit</FONT> -<BR>while(ACE_Thread::join(NULL,NULL,NULL)==0); -<BR>ACE_DEBUG((LM_DEBUG,"(%t)Other threads are finished. Program exiting..\n")); -<BR>} - -<P> <A HREF="../Chap_5/ex01.html">Next Example</A> -</BODY> -</HTML> |