Advertisement
Guest User

Untitled

a guest
Dec 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <pthread.h>
  3.  
  4. void *rutina(void* param) {
  5. int p = *((int *) param);
  6.  
  7. for(int i = 0; i < 10; i++) {
  8. printf("%d", i);
  9. }
  10.  
  11. return NULL;
  12. }
  13.  
  14.  
  15. int main() {
  16. for(int i = 0; i < 5; i++) {
  17. pthread_create(&i, NULL, rutina, &i);
  18. }
  19.  
  20. int **ret;
  21. for(int i = 0; i < 5; i++) {
  22. pthread_join(i, ret);
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement