Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // threads
- pthread_t threads[map->n_thread];
- int id_thread[map->n_thread];
- id_thread[0] = 0;
- if (pthread_create(&threads[0],NULL,scheduler, &id_thread[0]) != 0)
- perror("Error creating scheduler");
- for(i=1;i<map->n_thread;i++){
- id_thread[i] = i;
- if (pthread_create(&threads[i],NULL,worker,&id_thread[i]) != 0) //worker -> função que as threads vão fazer
- perror("Error creating threads");
- }
- for(i=0;i<map->n_thread;i++){
- pthread_join(threads[i],NULL);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement