/* * programa exemplo */ #include "mthr.h" volatile int s = 0; /* Variavel compartilhada */ void* f_thread(void *v) { step(); int thr_id; step(); thr_id = (int) v; step(); s = thr_id; step(); printf("Thread %d, s = %d.\n", thr_id,s); return NULL; } int main() { int i; for(i=0;i<10;i++) addPthread(NULL, f_thread, (void*)i); Pthread_create(); Pthread_join(); return 0; }