Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. static buffer [64];
  2. return buffer ;
  3.  
  4. n=6;
  5. pthread_t thread_ID[n];
  6. void *thread_result;
  7. int value = 1;
  8. int i;
  9.  
  10. // Create the thread , passing & value for the argument
  11. for (i = 0; i < n; i++)
  12. {
  13. pthread_create(&thread_ID[i], NULL, thread_function, &value);
  14. }
  15. for (i = 0; i < n; i++)
  16. {
  17. pthread_join(thread_ID[i], &thread_result);
  18. }
  19.  
  20. int *w[n];
  21. printf("After initialization W = ");
  22.  
  23. for (i = 0; i < n; i++)
  24. {
  25. w[i] = (int *)thread_result;
  26. printf("%d ", *w[i]);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement