/* * programa exemplo */ #include "mthr.h" volatile int s = 0; /* Variavel compartilhada */ void* f_thread(void *v) { int thr_id; thr_id = (int) v; printf(":%d\n",thr_id); s = thr_id; printf(":%d\n",thr_id); sched; printf(":%d\n",thr_id); 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; }