% % This file was automatically produced at Feb 27 2003, 22:51:56 by % c2latex mutex1.c % \expandafter\ifx\csname indentation\endcsname\relax% \newlength{\indentation}\fi \setlength{\indentation}{0.5em} \begin{flushleft} {\tt \#define} NUM\_THREADS 5\mbox{}\\ \mbox{}\\ {\bf void} $\ast$thread( {\bf void} $\ast$t\_id ) \{\mbox{}\\ \hspace*{8\indentation}{\bf int} i;\mbox{}\\ \hspace*{8\indentation}{\bf for} ( i = 0; i $<$ 200; ++i ) \{\mbox{}\\ \hspace*{16\indentation}pthread\_mutex\_lock( \&data.mutex );\mbox{}\\ \hspace*{16\indentation}++data.value;\mbox{}\\ \hspace*{16\indentation}printf( {\tt"thread \%d: data value $=$ \%d$\backslash$n"},\mbox{}\\ \hspace*{24\indentation}t\_id, data.value );\mbox{}\\ \hspace*{16\indentation}pthread\_mutex\_unlock( \&data.mutex );\mbox{}\\ \hspace*{8\indentation}\}\mbox{}\\ \hspace*{8\indentation}pthread\_exit( NULL );\mbox{}\\ \}\mbox{}\\ \end{flushleft}