28.11.2014 Views

System call - Processi, thread

System call - Processi, thread

System call - Processi, thread

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

main ()<br />

{ p<strong>thread</strong>_t th1, th2;<br />

void *ret;<br />

sem_init (&my_sem, 0, 0); /* semaforo a 0 */<br />

if (p<strong>thread</strong>_create (&th1, NULL, <strong>thread</strong>1_process, NULL) < 0)<br />

{ fprintf (stderr, "p<strong>thread</strong>_create error for <strong>thread</strong><br />

1\n");<br />

exit (1);<br />

}<br />

if (p<strong>thread</strong>_create(&th2,NULL, <strong>thread</strong>2_process, NULL) < 0)<br />

{fprintf (stderr, "p<strong>thread</strong>_create error for <strong>thread</strong> \n");<br />

exit (1);<br />

}<br />

}<br />

p<strong>thread</strong>_join (th1, &ret);<br />

p<strong>thread</strong>_join (th2, &ret);<br />

M-fosset - Sistemi Operativi 2004-2005

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!