You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
main ()<br />
{<br />
p<strong>thread</strong>_t th1, th2;<br />
int retcode;<br />
if (p<strong>thread</strong>_create(&th1,NULL,my_<strong>thread</strong>_process,"1") < 0)<br />
{ fprintf (stderr, "p<strong>thread</strong>_create error for <strong>thread</strong> 1\n");<br />
exit (1);<br />
}<br />
if (p<strong>thread</strong>_create(&th2,NULL,my_<strong>thread</strong>_process,"2") < 0)<br />
{ fprintf (stderr, "p<strong>thread</strong>_create error for <strong>thread</strong> 2\n");<br />
exit (1);<br />
}<br />
retcode = p<strong>thread</strong>_join (th1, NULL);<br />
if (retcode != 0)<br />
fprintf (stderr, "join fallito %d\n", retcode);<br />
else printf(“terminato il <strong>thread</strong> 1\n);<br />
}<br />
retcode = p<strong>thread</strong>_join (th2, NULL);<br />
if (retcode != 0)<br />
fprintf (stderr, "join fallito %d\n", retcode);<br />
else printf(“terminato il <strong>thread</strong> 2\n);<br />
return 0;<br />
M-fosset - Sistemi Operativi 2004-2005