%
% This file was automatically produced at Feb 27 2003, 22:51:56 by
% c2latex hello.c
%
\expandafter\ifx\csname indentation\endcsname\relax%
\newlength{\indentation}\fi
\setlength{\indentation}{0.5em}
\begin{flushleft}
{\tt \#include} $<${\tt{}pthread.h}$>$\mbox{}\\
{\tt \#include} $<${\tt{}stdio.h}$>$\mbox{}\\
{\tt \#define} NUM\_THREADS	5\mbox{}\\
{\bf void} $\ast$ print\_hello( {\bf void} $\ast$threadid )\mbox{}\\
\{\mbox{}\\
\hspace*{8\indentation}printf( {\tt"$\backslash$n\%d: Hello World!$\backslash$n"}, threadid );\mbox{}\\
\hspace*{8\indentation}pthread\_exit( NULL );\mbox{}\\
\}\mbox{}\\
{\bf int} main()\mbox{}\\
\{\mbox{}\\
\hspace*{8\indentation}pthread\_t threads[ NUM\_THREADS ];\mbox{}\\
\hspace*{8\indentation}{\bf int} rc, t;\mbox{}\\
\hspace*{8\indentation}{\bf for} ( t = 0; t $<$ NUM\_THREADS; t++ ) \{\mbox{}\\
\hspace*{16\indentation}printf( {\tt"Creating thread \%d$\backslash$n"}, t );\mbox{}\\
\hspace*{16\indentation}rc = pthread\_create( \&threads[ t ], NULL, print\_hello, ( {\bf void} $\ast$ ) t );\mbox{}\\
\hspace*{16\indentation}{\bf if} ( rc ) \{ printf( {\tt"ERROR; pthread\_create() returned \%d$\backslash$n"}, rc );\mbox{}\\
\hspace*{24\indentation}exit( $-$1 );\mbox{}\\
\hspace*{16\indentation}\}\mbox{}\\
\hspace*{8\indentation}\}\mbox{}\\
\hspace*{8\indentation}pthread\_exit( NULL );\mbox{}\\
\}\mbox{}\\
\end{flushleft}
